简体   繁体   English

TypeScript这个语法是什么' - ?' (冲刺问题)是什么意思?

[英]TypeScript What does this grammar '-?' (dash question) mean?

guys. 家伙。

I am new to typescript and saw '-?' 我是打字稿的新手,看到' - ?' grammar in @types/prop-types package @ types / prop-types包中的语法

eg 例如

export type ValidationMap<T> = { [K in keyof T]-?: Validator<T[K]> };

what does '[K in keyof T]-?' '[关键字T中的K] - 是什么? mean? 意思?

I tried my best to google that, but failed. 我尽力去谷歌,但失败了。

Thank you. 谢谢。

Homomorphic mapped types copy the optionality of the original type field to the mapped type field. 同态映射类型将原始类型字段的可选性复制到映射的类型字段。 The -? -? is the syntax used to explicitly remove any optional modifier from the resulting mapped type. 是用于从结果映射类型中显式删除任何可选修饰符的语法。 You can read more details here 你可以在这里阅读更多细节

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM