feat: typed route generation for expo router (#21651)
> Draft PR - just seeking feedback on the implementation.
# Why
WIP implementation of route generation for Expo Router.
# How
## Typ
feat: typed route generation for expo router (#21651)
> Draft PR - just seeking feedback on the implementation.
# Why
WIP implementation of route generation for Expo Router.
# How
## Typescript bootstrapping
This is expands the Typescript bootstrapping to also accommodate for
long-lived typescript watchers.
- Changes `waitForMetroToObserveTypeScriptFile` to
`metroWatchTypeScriptFiles`
- Processes are now responsible to disabling their watcher
- tsconfig can optionally be watched
## Type generation
`typedRouteGenerator` is invokes after the CLI has bootstrapped
TypeScript.
- Generates types only for absolute paths
- Supports static and dynamic routes
- Supports URL normalisation (TODO: Need unit tests for these!)
- Supports dynamic route parameter typing
# Test Plan
`EXPO_ROUTER_TYPED_ROUTES=true nexpo start`
// Todo
# Checklist
- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [x] This diff will work correctly for `expo prebuild` & EAS Build (eg:
updated a module plugin).
---------
Co-authored-by: Evan Bacon <[email protected]>
show more ...
|