Open robrechtme opened 1 year ago
Same here :(
Same
I've used a workaround of running pnpm start
and killing it after 10 seconds using timeout
. Here's an example working for me on GitHub actions:
- name: ʦ Generate mobile router types
run: timeout 10 pnpm start
working-directory: apps/mobile
continue-on-error: true
This could be quite brittle but works for now. Replace pnpm start
with yarn start
or pnpm run start
and change/remove working-directory
as needed. continue-on-error: true
is needed as timeout
returns a non-zero exit code and fails the job otherwise. timeout
is available on GitHub Linux runners, on macOS you can do brew install coreutils
to get timeout
.
Also looking for a good solution for this.
My current workaround is to add .expo/types
to git, modifying my .gitignore
like this, feels like an okayish solution at this time:
.expo/*
!.expo/types/
@robertherber ’s fix is a nice temporary solution.
It seems there is now a command to generate the types on demand. From the docs here:
If you find yourself in a situation where you need to generate these types without initiating the development server, such as during type checking on a Continuous Integration (CI) server. To do this, run the command
npx expo customize tsconfig.json
on the CI.
Which would solve OP's issue (and mine) but the command doesn't seem to work for me at least. I'm getting the following error:
CommandError: Invalid files: tsconfig.json. Allowed: babel.config.js, webpack.config.js, metro.config.js, web/serve.json, web/index.html
What am I doing wrong?
Related issue: https://github.com/expo/expo/issues/24818
What am I doing wrong?
Related issue: expo/expo#24818
For folks following along, the related issue has now been fixed & now you can use npx expo customize tsconfig.json
as of expo@49.0.16
.
@johnjensenish we can still repro this error in expo v50 even after running the npx expo customize tsconfig.json
"expo": "~50.0.14",
"expo-router": "3.4.8",
"react-native": "0.73.6",
@robertherber 's solution is still a viable workaround.
Getting this with expo router Href and Route types
Which package manager are you using? (Yarn is recommended)
yarn
Summary
👋 Not sure if this is a bug or a feature request...
We have a basic
yarn tsc
check runnning on CI for pull requests, which fails on TypeScript errors. If try to use theHref<T>
type, the CI pipeline breaks, because these types are dynamically generated. Is there a way to generate these dynamic types on CI?Minimal reproducible example
Simple example: