Skip to content

Type of React.ReactFragment, which includes {}, breaks certain usages of children in TS 3.1 #29307

@Jessidhia

Description

@Jessidhia

The type of ReactFragment currently includes {}, which causes the new, safer handling of typeof x === 'function' to only narrow x to Function.

Sample playground link

This same code would work as intended in TS 3.0.

I don't know why an empty object is considered a valid fragment; this allows literally anything to be passed as a child as long as it's not "fresh".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions