Skip to content

tsgo does not use assertion as a source for the type of a default export. #1741

@dragomirtitian

Description

@dragomirtitian

Steps to reproduce

// @filename: source.ts
class Foo<T> {
    #p!: T;
}

interface Bar {
    value: number
}

export default new Foo<Bar>();


// @filename: index.ts
import foo from './source';

// Error in tsgo
export default {
    foo
} as {
    foo: typeof foo
}

Playground

Behavior with typescript@5.8

The type for _default uses the type from the assertion.

Behavior with tsgo

Assertion types are ignored and we get the error: Default export of the module has or is using private name 'Bar'. (also happens to other variables)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions