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
When node16-esm resolves to a CJS module with types, we should run https://github.com/nodejs/cjs-module-lexer on it and compare the named exports visible to Node with the ones visible to TypeScript, and error for any that TS says are available that wouldn’t work in Node.
The text was updated successfully, but these errors were encountered:
This isn't specific to CommonJS, since ESM types can also lie about their exports. In that case it would be a matter of parsing the source texts with esbuild and following the ESM linker specification which isn't terribly complicated.
I struggled a bit extracting the expected runtime exported names from typescript's API since I'm not super familiar with it. My simple implementation fails to differentiate between type-only exports and real exports. If you could point out how to extract that information then I could contribute an implementation which can statically determine the result of Object.keys(await import(moduleName)) under nodejs. With those pieces in place it would just be a matter of a flat diff between the two array of export names.
When node16-esm resolves to a CJS module with types, we should run https://github.com/nodejs/cjs-module-lexer on it and compare the named exports visible to Node with the ones visible to TypeScript, and error for any that TS says are available that wouldn’t work in Node.
The text was updated successfully, but these errors were encountered: