Skip to content

Should leading ampersands (&) be allowed in intersection types? #17916

Closed
@Ailrun

Description

@Ailrun

TypeScript Version: 2.4.2 / playground (2.3.?)

Code

let x: (& number & string);

Expected behavior:
Emits error, since language spec said,

IntersectionType: IntersectionOrPrimaryType & PrimaryType

in the subsection 3.8.7

Actual behavior:
Doesn't emit error and uses it as number & string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions