You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to use type-coverage-core from our test framework in node. Unfortunately, the import style used in the project is incompatible with the recommended node tsconfig, targeting commonjs without esModuleInterop. A script which uses type-coverage-core causes the whole project's build to fail, as:
node_modules/type-coverage-core/dist/core.d.ts:1:8 - error TS1259: Module '"/home/faux/code/snyk/registry/node_modules/typescript/lib/typescript"' can only be default-imported using the 'esModuleInterop' flag
1 import ts from 'typescript';
~~
node_modules/typescript/lib/typescript.d.ts:7204:1
7204 export = ts;
~~~~~~~~~~~~
This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
node_modules/type-coverage-core/dist/interfaces.d.ts:1:8 - error TS1259: Module '"/home/faux/code/snyk/registry/node_modules/typescript/lib/typescript"' can only be default-imported using the 'esModuleInterop' flag
1 import ts from 'typescript';
~~
node_modules/typescript/lib/typescript.d.ts:7204:1
7204 export = ts;
~~~~~~~~~~~~
This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
This can't be ignored with ts-expect-error, but can be worked around with dynamic requires.
It isn't as simple as switching it to the commonjs compatible (but still safe) import syntax, as that's incompatible with your module target.
I humbly request that you switch to targeting commonjs, and disable esModuleInterop, to make the module easier to use from a node application, which I assume to be the most common usecase?
I'm currently working around this by not installing type-coverage-core, // @ts-expect-erroring the import, then installing it just to run with ts-node. npx also fails for us, absolutely no idea why; maybe another bug report when I rule out the rest of our system. skipLibCheck also works, if you're happy with that.
I think we have it turned off because of some compatibility problem with some mocking library, although who knows if that has been fixed over the last years.
Edit: Oh, and 250+ compile errors for turning it on, of course. :)
Version(if relevant): 2.14.9
I'd like to use
type-coverage-core
from our test framework in node. Unfortunately, the import style used in the project is incompatible with the recommended node tsconfig, targetingcommonjs
withoutesModuleInterop
. A script which usestype-coverage-core
causes the whole project's build to fail, as:This can't be ignored with ts-expect-error, but can be worked around with dynamic requires.
It isn't as simple as switching it to the commonjs compatible (but still safe) import syntax, as that's incompatible with your module target.
I humbly request that you switch to targeting commonjs, and disable esModuleInterop, to make the module easier to use from a node application, which I assume to be the most common usecase?
I'm currently working around this by not installing type-coverage-core,
// @ts-expect-error
ing the import, then installing it just to run withts-node
.npx
also fails for us, absolutely no idea why; maybe another bug report when I rule out the rest of our system.skipLibCheck
also works, if you're happy with that.The text was updated successfully, but these errors were encountered: