The error relates to enums, and exports using the new typescript node resolution (with the typings property in the package.json). I have tested this on typescript@next.
The bug can be reproduced through the following scenario: (please go to https://github.com/christyharagan/typeScript-enum-export-bug to find this code):
Three projects: a, b, c.
b depends on a
c depends on b
a exports an enum through its index.ts:
b then exports a function that returns E through its index.ts:
import {E} from 'a'
export function f():E {
return null
}
c then consumes f through its index.ts:
import {E} from 'a'
import {f} from 'b'
let e:E = f()
There is now an error for e:
Type 'E' is not assignable to type 'E'.
All three packages have a package.json that looks like this:
{
"name": "b",
"version": "1",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"dependencies": {
"a": "1"
}
}
And a tsconfig.json that looks like:
{
"compilerOptions": {
"declaration": true,
"module": "commonjs",
"rootDir": "./src",
"target": "es5",
"outDir": "./lib"
},
"files": [
"src/index.ts"
]
}
Furthermore, this defect occurs if f were to export another symbol (e.g. an interface) which references an exported enum somewhere within it's structure or hierarchy.
This only seems to affect enums, not other types.
The error relates to enums, and exports using the new typescript node resolution (with the typings property in the package.json). I have tested this on typescript@next.
The bug can be reproduced through the following scenario: (please go to https://github.com/christyharagan/typeScript-enum-export-bug to find this code):
Three projects:
a,b,c.bdepends onacdepends onbaexports an enum through its index.ts:bthen exports a function that returnsEthrough its index.ts:cthen consumesfthrough its index.ts:There is now an error for
e:All three packages have a package.json that looks like this:
And a tsconfig.json that looks like:
Furthermore, this defect occurs if
fwere to export another symbol (e.g. an interface) which references an exported enum somewhere within it's structure or hierarchy.This only seems to affect enums, not other types.