Skip to content

Primitive intersections. Why is this allowed? #12435

@electricessence

Description

@electricessence

TS Version
Currently using 2.2dev for 1121

Code

type Primitive = string | number | boolean;
type PrimitiveIntersection = string & number & boolean;

Expected behavior:
The compiler should at least warn the coder that this is invalid. I know it would be hard to track in some cases, but it seems this blatant declaration shouldn't be allowed.

Actual behavior:
No warning occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions