Allow to specify the location to generate Route Module types #12450
khabubuphathu
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
Currently, the Type Safety CLI in React Router does not provide an option to specify the location where the Route Module types should be generated. This limitation can lead to inconvenience for developers who may be using a monorepo and have specific package for types that they would like to share with other packages. Limiting developers to rely of the no typesafe option of
ActionFunctionArgs
andLoaderFunctionArgs
Solution
Introduce a new option in the Type Safety CLI that allows developers to specify the directory where the Route Module types should be generated. This option can be added as a command-line argument or a configuration setting in Vite plugin
Implementation
--types-dir
, to specify the directory for generated types.vite.config.ts
, under a new property liketypesDir
.Example Usage
# Using command-line argument react-router typegen --types-dir ../../packages/types
Beta Was this translation helpful? Give feedback.
All reactions