-
-
Notifications
You must be signed in to change notification settings - Fork 695
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
Import assignment cannot be used when targeting ECMAScript modules #161
Comments
I cannot document all the possible config you can use with TS. The instructions are for default TS. Try to Google the error. |
what is the default TS ? |
All of the functions are missing like If I keep
That means Typescript is importing the actual code correctly but the typings are wrong. I've yet to see someone recommend Generally in typescript you'd use My tsconfig: {
"compilerOptions": {
"outDir": "build/dist",
"module": "esnext",
"target": "es2015",
"lib": ["es2016", "dom"],
"esModuleInterop": true,
"sourceMap": true,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": "/",
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
// add skipLibCheck for antd.
// https://github.com/ant-design/ant-design/issues/5627#issuecomment-339056618
// can maybe try remove it someday
"skipLibCheck": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
// needed to prevent error TS1192: Module 'react' has no default export.
// https://ant.design/docs/react/introduce#TypeScript
"allowSyntheticDefaultImports": true,
// this allows you to reference modules stored in lib with non-relative names
// https://www.typescriptlang.org/docs/handbook/module-resolution.html#base-url
"baseUrl": "lib"
},
"exclude": [
"node_modules"
]
}
|
here is what I do after updating to version 5: import screenfull, { Screenfull } from 'screenfull';
const fullScreen = (screenfull.isEnabled) ? screenfull as Screenfull : undefined; So my constant if (fullScreen) {
fullScreen.toggle();
..
} |
I'm using screenfull.js in typescript project targeting ES2015.
After updating to v 5.0.0 I should make a change in import statement
You need to change import screenfull from 'screenfull'; to import screenfull = require('screenfull');
vscode mark this import with following error:
The text was updated successfully, but these errors were encountered: