frontarm / navi

🧭 Declarative, asynchronous routing for React.
https://frontarm.com/navi/
MIT License
2.07k stars 71 forks source link

Fix tsc incompatibility #182

Closed strass closed 4 years ago

strass commented 4 years ago

I run tsc --noEmit during CI to ensure that my app's types don't have any errors. It has now started catching these, (even though I have node_modules excluded in my tsconfig.json) and they're easy fixes.

$ tsc --noEmit -p .

node_modules/react-navi/src/Link.tsx:25:25 - error TS7006: Parameter 'href' implicitly has an 'any' type.

25 function isExternalHref(href) {


node_modules/react-navi/src/Link.tsx:38:4 - error TS7030: Not all code paths return a value.

38 ): undefined | URLDescriptor {

node_modules/react-navi/src/Link.tsx:164:52 - error TS6133: 'e' is declared but its value is never read.

164 navigation.prefetch(memoizedLinkURL).catch(e => { ~

strass commented 4 years ago

Aah, I figured it out. I was importing

import { LinkProps as RNLinkProps, UseLinkPropsOptions, } from "react-navi/src/Link";

instead of

import { LinkProps as RNLinkProps, UseLinkPropsOptions, } from "react-navi/dist/types/Link";

I'll leave the PR open in case you want it.