Skip to content

TS2322 error in tsgo but not tsc #1609

@jfirebaugh

Description

@jfirebaugh

Steps to reproduce

With default compiler options:

enum E {
  Foo,
  Bar,
}
type A = { type: 'a'; e: E }
type B = { type: 'b' }
type C = A & { e: E.Bar }

function fn(v: A | B | C): A | B | C {
  return { ...v, e: E.Foo }
}

Behavior with [email protected]

Typechecks successfully.

Behavior with tsgo

index.ts:10:18 - error TS2322: Type 'E.Foo' is not assignable to type 'E.Bar'.

Metadata

Metadata

Assignees

Labels

Domain: Type CheckingRelated to type checking, grammar checking

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions