typescript-go
typescript-go copied to clipboard
Named import against CJS file with `module.exports = { ... }` errors only with tsgo
Steps to reproduce
- Clone https://github.com/sapphi-red-repros/typescript-go-cjs-named-import-behavior-difference
- Run
pnpm i - Run
pnpm tscandpnpm tsgo
Behavior with [email protected]
No error
Behavior with tsgo
foo.ts:1:19 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.
1 import { a } from './bar.cjs'
~~~~~~~~~~~
It seems this happens with the following code as well:
import { Token } from 'js-tokens';
export type Foo = Token