Reflect-metadata broken in 1.6.2: TS2306: File 'node_modules/reflect-metadata/reflect-metadata.d.ts' is not a module.
mattyork opened this issue · 5 comments
mattyork commented
To reproduce:
- Update to Typescript v1.6.2 and reflect-metadata v0.1.1
- Compile this:
/// <reference path="node_modules/reflect-metadata/reflect-metadata.d.ts" />
import 'reflect-metadata';
Expected: compiles just fine
Actual: compile error:
index.ts(3,8): error TS2306: File 'node_modules/reflect-metadata/reflect-metadata.d.ts' is not a module.
I created a git repo to demonstrate:
git clone https://github.com/mattyork/TypescriptReflectMetadataBug.git
cd TypescriptReflectMetadataBug
npm install
./node_modules/.bin/tsc
If I delete the typings field in package.json this error goes away. What is this typings field for and why is it causing this bug?
mhegazy commented
we either need to remove the typings field, or make it an empty module, e.g.
interface reflect_metadata {}
export = reflect_metadata;
rbuckton commented
I'll have to remove "typings", as making it an external module will prevent the library from introducing globals.
rbuckton commented
I removed "typings" from the reflect-metadata polyfill and published a new version to npm.
rtm commented
/// <reference path="node_modules/reflect-metadata/reflect-metadata.d.ts" />
What is the way to modify tsconfig.json to accomplish the same effect?
kitsonk commented
Include the file in the "files": [] property.