Open largis21 opened 5 months ago
Is your feature request related to a problem? Please describe.
Most codebases have a strict naming convention, i.e prefixing every type with "i". This is not currently possible with typegen generate.
Describe the solution you'd like
Adding a format property to the sanity-typgen.json config file:
format
sanity-typgen.json
"format": { "schemaTypes": { "literal": "i{name}Schema", "nameCase": "camel" // camel | pascal | snake }, "queries": { "literal": "i{name}", "nameCase": "camel" } }
Open to suggestions for the api.
Example:
// sanity-typegen.json { "path": "'./**/*.{ts,tsx,js,jsx}'", "schema": "schema.json", "generates": "sanity.types.ts", "format": { "schemaTypes": { "literal": "i{name}Schema", "nameCase": "pascal" }, "queries": { "literal": "i{name}", "nameCase": "pascal" } } }
// Old result SomeDocumentType = {...}
// New result iSomeDocumentTypeSchema = {...}
Describe alternatives you've considered
Using as when importing
as
Additional context I have submitted a pr which I will extend later today: https://github.com/sanity-io/sanity/pull/6559
The proof of concept is now finished #6559
Is your feature request related to a problem? Please describe.
Most codebases have a strict naming convention, i.e prefixing every type with "i". This is not currently possible with typegen generate.
Describe the solution you'd like
Adding a
format
property to thesanity-typgen.json
config file:Open to suggestions for the api.
Example:
Describe alternatives you've considered
Using
as
when importingAdditional context I have submitted a pr which I will extend later today: https://github.com/sanity-io/sanity/pull/6559