Skip to content

tsgo missing TS2540 error with default export #2178

@jfirebaugh

Description

@jfirebaugh

Steps to reproduce

a.ts:

const foo = {
  a: 1
}

export default foo as Readonly<typeof foo>

b.ts:

import foo from './a'

foo.a = 2

Behavior with typescript@5.9

$ tsc a.ts b.ts                   
b.ts:3:5 - error TS2540: Cannot assign to 'a' because it is a read-only property.

3 foo.a = 2
      ~


Found 1 error in b.ts:3

Behavior with tsgo

$ tsgo --version
Version 7.0.0-dev.20251202.1
$ tsgo a.ts b.ts

I.e. no error.

Metadata

Metadata

Assignees

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