Skip to content

tsc says types are not exported but they are #21447

@jasonkuhrt

Description

@jasonkuhrt

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.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions