mercredi 17 février 2021

true as false type assertion in TypeScript

In TypeScript, why is the following code considered valid (doesn't throw a compiler error):

const bool = true as false;

I'm wondering about both implementation-wise and as a language design decision?




Aucun commentaire:

Enregistrer un commentaire