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

Reflect-metadata broken in 1.6.2: TS2306: File 'node_modules/reflect-metadata/reflect-metadata.d.ts' is not a module. #4877

Closed
mattyork opened this issue Sep 19, 2015 · 5 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue High Priority

Comments

@mattyork
Copy link

To reproduce:

  1. Update to Typescript v1.6.2 and reflect-metadata v0.1.1
  2. 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 mhegazy added the Bug A bug in TypeScript label Sep 21, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Sep 21, 2015

we either need to remove the typings field, or make it an empty module, e.g.

interface reflect_metadata {}
export = reflect_metadata;

@rbuckton
Copy link
Member

I'll have to remove "typings", as making it an external module will prevent the library from introducing globals.

@rbuckton
Copy link
Member

I removed "typings" from the reflect-metadata polyfill and published a new version to npm.

@rtm
Copy link

rtm commented Jul 12, 2016

/// <reference path="node_modules/reflect-metadata/reflect-metadata.d.ts" />

What is the way to modify tsconfig.json to accomplish the same effect?

@kitsonk
Copy link
Contributor

kitsonk commented Jul 12, 2016

Include the file in the "files": [] property.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue High Priority
Projects
None yet
Development

No branches or pull requests

5 participants