Skip to content

Validate unidirectional assignability #39

Closed
@SamVerschueren

Description

@SamVerschueren

Since 0.9.0, expectType assertions are strict. Buy maybe this isn't always what we want.

type Color = 'red' | 'blue';

expectType<Color>('red');

This will fail because Color is not assignable to red unless you explicitly cast it to Color.

type Color = 'red' | 'blue';

expectType<Color>('red' as Color);

Should we add a loose (or unidirectional) expectType variant for these cases?

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions