Skip to content

TS2322 error in tsgo but not tsc #63778

Description

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 typescript@5.8

Typechecks successfully.

Behavior with tsgo

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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