-
Notifications
You must be signed in to change notification settings - Fork 264
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
TypeScript import without 'esModuleInterop' #127
Comments
@Baterka you can import (without the import ms = require('ms'); |
The The module is written in CJS, so if you're using ES modules, interop is needed to import it, as a default. |
@kingdaro thanks for your comment! I had not been aware that the Is migrating the |
Why closed? |
i'm having problem too. why closed? |
Same here, I inserted the {
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
}
}
` |
same for me! |
https://www.npmjs.com/package/@types/ms is this library already typescript in your source? why are you still maintaining the |
the solution might be to install the canary version, like this: and import as follows: are now using string types, the code would look like this: export class DateInterval {
public readonly ms: number;
constructor(interval: StringValue) {
this.ms = ms(interval);
}
} |
When importing into TypeScript file with
@types/ms
installed I am getting:Sure, I can turn
esModuleInterop
, but no other module I used had this issue.Fix can be maybe to update code?
The text was updated successfully, but these errors were encountered: