guys.
I am new to typescript and saw '-?' grammar in @types/prop-types package
e.g
export type ValidationMap<T> = { [K in keyof T]-?: Validator<T[K]> };
what does '[K in keyof T]-?' 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With