expo / router

[ARCHIVE]: Expo Router has moved to expo/expo -- The File-based router for universal React Native apps
https://docs.expo.dev/routing/introduction/
1.36k stars 113 forks source link

Importing from expo-router/tabs fails type checking #807

Closed erquhart closed 1 year ago

erquhart commented 1 year ago

Which package manager are you using? (Yarn is recommended)

npm

Summary

A typescript project that imports expo-router/tabs won't pass type checking. I wouldn't expect dependencies to have any impact this way, I suspect it's how the module is being exported.

Minimal reproducible example

To just view it, look at the latest terminal output in this cloud sandbox: https://codesandbox.io/p/sandbox/musing-rui-7nyp7q

To repro:

  1. Fork this cloud sandbox: https://codesandbox.io/p/sandbox/musing-rui-7nyp7q
  2. Run npm install && npx tsc in the terminal
erquhart commented 1 year ago

Found the fix - import from expo-router instead of expo-router/tabs. Not sure if this is intended as the docs say otherwise.

marklawlor commented 1 year ago

Closing issue as this should be fixed in the latest version. I did notice that your codesandbox was missing @types/react which will cause the expo-router types to fallback to any, but it shouldn't have caused a failure.

If your still having issues can you reply and I'll reopen the issue.