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

Type errors reported in NavLink when only "to" is used #1518

Closed
Razican opened this issue Jul 2, 2020 · 4 comments
Closed

Type errors reported in NavLink when only "to" is used #1518

Razican opened this issue Jul 2, 2020 · 4 comments
Labels

Comments

@Razican
Copy link

Razican commented Jul 2, 2020

Hi, I just recently started developing with inferno, and I found this type error I'm getting using NavLink. It might be a bug in the type definition, or it might just be me not understanding what's happening.

Observed Behaviour

The following code is giving a type error:

<NavLink to="somewhere">Link label</NavLink>

This gives:

error TS2740: Type '{ children: string; to: string; }' is missing the following properties from type '{ [x: string]: any; to: any; exact: any; strict: any; onClick: any; location: any; activeClassName?: string; className: any; activeStyle: any; style: any; isActive: any; ariaCurrent?: string; }': exact, strict, onClick, location, and 4 more.

Expected Current Behaviour

If I understand NavLink properly, those parameters should be optional, as it happens with Link, but instead, they are mandatory, as it can be seen in the source code.

Inferno Metadata

This is happening in Fedora Linux, inferno-router 7.4.2, with typescript 3.9.6

@Havunen
Copy link
Member

Havunen commented Jul 2, 2020

I think you are right here. Would you like to make PR to fix it? :)

@Razican
Copy link
Author

Razican commented Jul 3, 2020

I think you are right here. Would you like to make PR to fix it? :)

Sure! Is there documentation on which options are mandatory and which ones are optional?

@Havunen
Copy link
Member

Havunen commented Jul 3, 2020

I think those typings are the only documentation we have. The router was initially based on react-router https://github.com/ReactTraining/react-router

Maybe that can give some hint.
Ultimately we can just try out what works and change types accordingly :)

@Havunen
Copy link
Member

Havunen commented Sep 19, 2020

I have fixed this issue here: 85aa251
Fix is available in v7.4.4

@Havunen Havunen closed this as completed Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants