haxe-react
haxe-react copied to clipboard
Props type checking failing with constrained type parameters
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.