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
Stack breaks typescript in v2 #24933
Comments
The repo was missing one commit, just sent it |
I'll have to roll everything back to react navigation :/ |
This page should have a warning sayng that expo router is still beta and not production ready |
I cloned the repo, ran npm install, there is no type error. You might want to check your local setup |
I just saw that it's when you run
not sure which ones are actually useful |
I tried it but still get the same errors :/ |
I get the type errors when I import tabs for some reason #25213 |
I created a script to ignore expo-router type errors when type checking (sdk49) it's a bit hacky but it'll have to do until we upgrade to sdk50 which should have the problem fixed, I had to do this because I couldn't ignore the errors using tsconfig exclude and ts-ignore: "build": "tsc -v && (tsc --noEmit --pretty > tsc_output.txt) || (cat tsc_output.txt; echo \"\ntsc failed, attempting manual resolution...\"; bash tsc_check.sh)" tsc_check.sh file: #!/bin/bash
# Check if the "Errors Files" line exists at the start
if grep -q "Errors Files" tsc_output.txt; then
# Save the number of lines containing "expo-router" errors
expo_router_error_count=$(awk '/Errors Files/ {flag=1; next} flag && /expo-router/ {count++} END {print count}' tsc_output.txt)
# Save the number of lines after "Errors Files"
lines_after_errors_files=$(awk '/Errors Files/ {flag=1; next} flag {count++} END {print count}' tsc_output.txt)
# Check if the counts are equal
if [ "$expo_router_error_count" -eq "$lines_after_errors_files" ]; then
echo "Number of 'expo-router' errors is equal to the number of lines after 'Errors Files'. Proceeding with 'tsc' command."
exit 0
else
echo "Number of 'expo-router' errors is not equal to the number of lines after 'Errors Files'. Exiting 'tsc' command."
exit 1
fi
else
echo "The 'Errors Files' line does not exist. Proceeding with 'tsc' command."
exit 0
fi
|
Duplicate of #25478 -- we've published the alpha of v3, if you're truly blocked then you can try upgrading today. |
how can this be the duplicate if it is way older? |
@EvanBacon It is very strange to be forced to upgrade to an alpha version to fix types checks from node_modules folder. |
All right, I fixed the errors by changing my import from
to
I believe I was importing a ts file and it was causing the problems. This comment helped me: microsoft/TypeScript#40426 (comment) |
I built this script specifically to ignore the router type errors |
this doesn't fix tabs for me |
Should be resolved in Expo Router v3. If you are still having this issue with version 3, can you please create a new issue with a reproduction repo |
Minimal reproducible example
https://github.com/lhguerra/expo-router-stack-typescript-bug
Which package manager are you using? (Yarn is recommended)
npm
If the issue is web-related, please select the bundler (
web.bundler
in theapp.json
)metro
Summary
When adding Stack component to the _layout, it breaks the type check with a bunch of errors in expo-router lib.
Just download the repository above, install the dependencies and run
npm run lint:ts
Environment
expo-env-info 1.0.5 environment info:
System:
OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
npmPackages:
expo: ^49.0.3 => 49.0.13
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.72.3 => 0.72.3
react-native-web: ~0.19.6 => 0.19.9
npmGlobalPackages:
eas-cli: 5.0.2
expo-cli: 6.3.10
Expo Workflow: managed
The text was updated successfully, but these errors were encountered: