Skip to content

TypeScript outputs incorrect definition files for _tag fields #118

Closed
@gcanti

Description

@gcanti

Example: Option.d.ts

export declare class None<A> implements FantasyMonad<URI, A>, FantasyFoldable<A>, FantasyTraversable<URI, A>, FantasyAlternative<URI, A>, FantasyExtend<URI, A> {
    static of: typeof of;
    static empty: typeof empty;
    static zero: typeof zero;
    static value: Option<any>;
    readonly _tag: string; // this should be 'None', not `string`
    readonly _A: A;
    readonly _URI: URI;
    private constructor();

    ...
}

Can be fixed by adding an explicit type annotation in the source

readonly _tag: 'None' = 'None'

Relevant microsoft/TypeScript#15881

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions