Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsc says types are not exported but they are #21447

Closed
jasonkuhrt opened this issue Jan 29, 2018 · 4 comments
Closed

tsc says types are not exported but they are #21447

jasonkuhrt opened this issue Jan 29, 2018 · 4 comments
Assignees
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Fixed A PR has been merged for this issue

Comments

@jasonkuhrt
Copy link

jasonkuhrt commented Jan 29, 2018

tsconfig.json

{
  "compilerOptions": {
    "strict": true,
    "noImplicitReturns": true,
    "target": "es2015",
    "module": "commonjs",
    "outDir": "./build"
  },
  "include": ["./repro.ts"],
  "exclude": ["./source/**/*"]
}

Working:

$ /Users/jason.kuhrt/projects/ssense/experiment/node_modules/.bin/tsc --project ./tsconfig.json --declaration --outDir build
✨  Done in 1.98s.
export interface Bar {
  a: boolean
}

export interface Foo {
  bar: Bar
}

const f = (x: any): Foo => {
  return { bar: { a: false } }
}

export { f }

Not working:

$ /Users/jason.kuhrt/projects/ssense/experiment/node_modules/.bin/tsc --project ./tsconfig.json --declaration --outDir build
repro.ts(9,7): error TS4025: Exported variable 'f' has or is using private name 'Foo'.
interface Bar {
  a: boolean
}

interface Foo {
  bar: Bar
}

const f = (x: any): Foo => {
  return { bar: { a: false } }
}

export { f, Bar, Foo }

I Don't see mention of support for export { A, B, C } style in https://www.typescriptlang.org/docs/handbook/modules.html but nor do I see it mentioning lack of support. So I assume there is support? Maybe I missed something.

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jan 29, 2018
@mhegazy mhegazy added this to the TypeScript 2.8 milestone Jan 29, 2018
@mhegazy mhegazy added the Domain: Declaration Emit The issue relates to the emission of d.ts files label Jan 29, 2018
@weswigham
Copy link
Member

weswigham commented Jan 30, 2018

What version are you seeing issues in? I don't see this reproducing on master, so I think this is likely a duplicate of one of the issues fixed by #19929.

@jasonkuhrt
Copy link
Author

@weswigham

❯ yarn -s build
$ rm -rf build
source/Experiment/index.ts(18,12): error TS4033: Property 'variant' of exported interface has or is using private name 'Variant'.

❯ yarn -s tsc --version
Version 2.6.2

@mhegazy
Copy link
Contributor

mhegazy commented Jan 31, 2018

@jasonkuhrt can you try with [email protected] instead?

@jasonkuhrt
Copy link
Author

@mhegazy works!

❯ yarn -s build && yarn -s tsc --version
$ rm -rf build
Version 2.7.1

@mhegazy mhegazy closed this as completed Feb 1, 2018
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Feb 1, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants