Skip to content

expectType does not work for same enums from two different namespaces #219

@maximzavadskiy

Description

@maximzavadskiy

Suppose we have the same enum type in our core code and in our lib - one lib(main.ts) and one in (lib.ts). expectType does not work as expected here.

// main.ts
export enum Foo {
  "A" = "A"
}


// lib.ts
export enum Foo {
  "A" = "A"
}



// test.test-d.ts
import {Foo} from "./main"
import {Foo as Foo2} from "./lib"

const aFoo: Foo = Foo.A
const _aFoo2: Foo2 = aFoo // Assignment - OK

expectType<Foo2>(aFoo) // Expected to pass, but gives error `Parameter type Foo is not identical to argument type Foo.

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