Kacper Kula
Jul 1, 2022

--

That's TypeScript conditional type syntax - you need to use `extends` in this case. As much as it resembles regular JavaScript ternary operator, it's not the same, you cannot drop comparison with true. More information:

https://www.typescriptlang.org/docs/handbook/2/conditional-types.html

Minimal example so you can experiment with it:

https://www.typescriptlang.org/play?#code/C4TwDgpgBAGgPAFShAHsCA7AJgZygIwHtCAbCAQwwD4oBeKJVdbPYAJwFdoB+KAIgQAlAKoIAEnygAufgDEAggBkAygFE+AbgBQW0JCjA6sOOy5Vte6ADMj8K+RI4I5nQHpXDNiChsIAW0IANwBLDABzKAADJkxcA04ISKgAWihgwwB3QgwAckNfAGNCMIxgpzTDcjxyKDA2Qkg2KBwQDGByFAA6IA

I hope that helps!

--

--

Kacper Kula
Kacper Kula

No responses yet