Support TS isolatedModules
See original GitHub issueWhen I try to yarn build
my Nextjs project using typescript and vega-lite, I get this error:
The following mandatory changes were made to your tsconfig.json:
- isolatedModules was set to true (requirement for babel)
Failed to compile.
./node_modules/vega-lite/src/compositemark/index.ts:28:9
Type error: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
26 | } from './errorbar';
27 |
> 28 | export {BoxPlotConfig} from './boxplot';
| ^
29 | export {ErrorBandConfigMixins} from './errorband';
30 | export {ErrorBarConfigMixins} from './errorbar';
31 |
error Command failed with exit code 1.
I think this is pointing to this line: https://github.com/vega/vega-lite/blob/22057b18d54e71be4cc7c959c5f83d43d765a697/src/compositemark/index.ts#L28
Do we need to update these export
statements to export type
?
I doubt that the vega-lite codebase is not compatible with Babel, since vega-lite is currently producing ES2015 output. So maybe my TypeScript configuration is wrong?
Here is my tsconfig.json
:
{
"compilerOptions": {
"target": "es6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"jsx": "preserve",
"baseUrl": ".",
"isolatedModules": true,
"downlevelIteration": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
isolatedModules - TSConfig Option
Exports of Non-Value Identifiers. In TypeScript, you can import a type and then subsequently export it: ts. import { ...
Read more >Why is --isolatedModules error fixed by any import?
In a create-react-app typescript project, I tried to write this just to test some stuff quickly: // experiment.test.ts it('experiment', () => { ...
Read more >Cannot be compiled under '--isolatedModules' because it is ...
'index.ts' cannot be compiled under // '--isolatedModules' because it is considered // a global script file. Add an import, export, // or an...
Read more >isolatedModules and no namespaces · Issue #15230 ...
Actual behavior: src/a.ts(1,1): error TS1208: Cannot compile . ... editors from the TS language service (tried both VS Code and Webstorm).
Read more >Isolated Modules option | ts-jest - GitHub Pages
Isolated Modules option ... By default ts-jest uses TypeScript compiler in the context of a project (yours), with full type-checking and features.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure! I can do that
We don’t support isolatedModules right now. Do you want to help us support it? What you need to do is set
"isolatedModules": true
in our tsconfig, runyarn tsc
and fix any errors that come up.