question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support TS isolatedModules

See original GitHub issue

When 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:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sid-kapcommented, Dec 24, 2021

Sure! I can do that

0reactions
domoritzcommented, Dec 24, 2021

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, run yarn tsc and fix any errors that come up.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found