Skip to content

Named import against CJS file with module.exports = { ... } errors only with tsgo #1954

@sapphi-red

Description

@sapphi-red

Steps to reproduce

  1. Clone https://github.com/sapphi-red-repros/typescript-go-cjs-named-import-behavior-difference
  2. Run pnpm i
  3. Run pnpm tsc and pnpm tsgo

Behavior with typescript@5.8

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'
                    ~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions