Closed
Description
TypeScript Version: 3.0.0-dev.20180704
Search Terms: enum, npm, yarn, import, create react app
Reproduction Github Repository
https://github.com/stephenkiers/TypescriptRepo1
Remote Package Code
export const enum TEST {
MAJOR = "major",
MINOR = "minor"
}
Target Package Code
type IFoo = {
type: TEST.MINOR|TEST.MAJOR;
name: string;
};
const foo: IFoo = {
type: TEST.MINOR,
name: "Full Name"
};
console.log(foo.type === TEST.MINOR ? foo.name : "World")
Expected behavior:
Target Package should print Full Name
Actual behavior:
TEST
is undefined, so there is Uncaught TypeError: Cannot read property 'MINOR' of undefined
Playground Link:
Cannot recreate in playground, but made public github repo and youtube video
Related Issues: not really, but here are some possible similar issues
- Issue with loose mode export { x } from 'x'; babel/babel#6805
- Use of enums is transpiled in a different way than with tsc TypeStrong/ts-node#515
- I added "preserveConstEnums" to .tsconfig to no avail
- https://stackoverflow.com/questions/47418124/enum-type-not-defined-at-runtime
Metadata
Metadata
Assignees
Labels
No labels