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

Update index.d.ts #5

Closed
wants to merge 1 commit into from
Closed

Update index.d.ts #5

wants to merge 1 commit into from

Conversation

joscha
Copy link

@joscha joscha commented Jun 6, 2017

Fixes:

Error at src/bla.tsx:2:27: Module '"/web/node_modules/uniqueid/index"' resolves to a non-module entity and cannot be imported using this construct.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling dbea9a8 on joscha:patch-1 into ** on jonschlinkert:master**.

@blakeembrey
Copy link
Collaborator

blakeembrey commented Jun 7, 2017

It isn't an ES6 module so you should be importing it using import uniqueid = require('uniqueid'). Importing it differently is incorrect and subject to breakage in future TypeScript releases, especially when the node.js module system to finalised.

@blakeembrey blakeembrey closed this Jun 7, 2017
@joscha
Copy link
Author

joscha commented Jun 7, 2017

@blakeembrey, import x = require('x') yields:

Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.

@blakeembrey
Copy link
Collaborator

blakeembrey commented Jun 7, 2017

Use CommonJS modules if you're trying to import CommonJS modules. I wouldn't recommend using ES6 modules if you aren't consuming ES6 modules.

@joscha
Copy link
Author

joscha commented Jun 7, 2017

if changes and decisions in a broader codebase were that easy :) Thanks for your time, will use a different module.

@blakeembrey
Copy link
Collaborator

What are you using? It's a flag in tsconfig.json to output CommonJS modules. If you aren't, all your code is subject to breaking in future TypeScript and node.js versions anyway.

@joscha
Copy link
Author

joscha commented Jun 7, 2017

I am using es6 as a target in prod and commonjs in test (due to https://github.com/kulshekhar/ts-jest only supporting commonjs). Thus I need to make it work for both scenarios. I can do so with the change in this PR - nvm, all good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants