Skip to content

Props type checking failing with constrained type parameters #7

@kLabz

Description

@kLabz

Type checker for props fails to handle this kind of props:

@:jsRequire('react-router-dom', 'Link')
extern class Link<T:LinkProps> extends ReactComponentOfProps<T> {}

And fails silently for any invalid prop passed to Link, since it ends up with a TMono(null) for props which will accept anything.

It will assume a type based on the prop value, which will also lead to compilation errors if some props can have a class as a value (ReactNode accepting a component class, for example), which will break with "Type not found : Class<my.pack.Component>".

Currently this is handled with a warning when such a thing is detected. Warnings can be disabled with -D react_ignore_failed_props_inference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions