TypeScript中的ThisType具体有什么用?

关注者
3
被浏览
11,041

3 个回答

不要被那个utils 空接口 迷惑了



const obj: ThisType<T> = {

foo() {

// this 类型为 T

}

}

This utility dose not return a transformed type. Instead, it serves as a marker for a contextual this type. Note that the - - noImplicitThis flag must be enabled to use this utility.