import `client` from `@sanity-typed/client` instead of `@sanity/client`
@sanity-typed is a project completes Sanity's developer experience with typescript, which includes @sanity-typed/client with typed GROQ Results. It seems to be good if nuxt-sanity can optionally import client from this package. Is it possible to do so for better TypeScript DX?
This is extremely cool. Would it be sufficient to allow the import to be configurable? Is it otherwise equivalent in API?
I think the most intuitive way to do so is to add typedClient configuration in sanity field in nuxt.config.ts:
sanity: {
projectId: 'myProject',
typedClient: true // requires users to explicitly set
},
Although this may be conflict with another configuration minimal. Maybe we can mix the two features up and do something like:
sanity: {
projectId: 'myProject',
clientType: 'typed' // can also be 'minimal' or 'default', defaults to 'default'
},
In this way, the minimal configuration should be deprecated, and causes breaking changes though.
For those who want better TypeScript DX, Sanity now introduces an experimental feature called Sanity TypeGen which supersedes @sanity-typed. Sanity TypeGen supports generate types via its CLI, so I think this issue can be closed now.