Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Props type checking failing with constrained type parameters #7

Open
kLabz opened this issue Sep 24, 2018 · 0 comments
Open

Props type checking failing with constrained type parameters #7

kLabz opened this issue Sep 24, 2018 · 0 comments

Comments

@kLabz
Copy link
Owner

kLabz commented Sep 24, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant