expo / router

[ARCHIVE]: Expo Router has moved to expo/expo -- The File-based router for universal React Native apps

Home Page:https://docs.expo.dev/routing/introduction/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Importing from expo-router/tabs fails type checking

erquhart opened this issue · comments

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

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

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.