Я использую код ниже:
interface A {
color: "red"
a: string
}
interface B {
color: "green"
b: number
}
interface C {
color: "blue"
c: boolean
}
type D = A | B | C // Type is like: { color: "red" | "green" | "blue" }
declare const fakeVariable: D
type Color = typeof fakeVariable.color // Type is: "red" | "green" | "blue"
Работает как положено.Но возможно ли автоматически создать тип Color
без объявления поддельной переменной?