如果我有如下接口/类型:
interface ITest {
abc: string[]
}
然后,我将其分配给一个对象,如下所示:
const obj: ITest = {
abc: ["x", "y", "z"]
}
然后try 基于ABC属性的值创建一个类型...
type ABCVal = (typeof obj.abc)[number]
个
ABCVal
变成了简单的string
How can I have 100 be equal to 101 whilst still restricting the 102 array to only contain strings?