如何在流中使用对象属性的类型?例如
type A = {
someproperty: string
}
// throws error
const b: A.someproperty = "hello"
最佳答案
您可以使用 $PropertyType<T,x>
utility type .
type A = {
someproperty: string
}
// this works fine
const b: $PropertyType<A, 'someproperty'> = "hello"
关于javascript - 如何在流中使用对象属性的类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44924922/