language-service
language-service copied to clipboard
Refactor to Schema: support conversion of `typeof A` where A is a const string to Literal
What is the problem this feature would solve?
given following code:
const A = 'A' as const
export type MyObj = {
a: typeof A
}
executing "Refactor to Schema" actions results in the following:
const A = 'A' as const
export const MyObj = Schema.Struct({
a: /* Not supported conversion: typeof A */
})
export type MyObj = {
a: typeof A
}
What is the feature you are proposing to solve the problem?
Would be great if given the input above, we could get the following schema:
export const MyObj = Schema.Struct({
a: Schema.Literal('A')
})
What alternatives have you considered?
No response