sos: interface value types to union types #7894
Answered
by
jiangshanmeta
2214962083
asked this question in
Q&A
-
how to convert Source to Target, help me !!! type Source = {
a: {
type: 'a'
sex: 'boy' | 'girl'
}
b: {
type: 'b'
name: string
}
}
type Target =
| {
type: 'a'
sex: 'boy' | 'girl'
}
| {
type: 'b'
name: string
} |
Beta Was this translation helpful? Give feedback.
Answered by
jiangshanmeta
Mar 28, 2022
Replies: 2 comments 1 reply
-
type Values = T[keyof T] |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jiangshanmeta
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
type Values = T[keyof T]