Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

https://www.typescriptlang.org/docs/handbook/type-compatibil...

For example: https://www.typescriptlang.org/docs/handbook/type-compatibil...

https://www.typescriptlang.org/docs/handbook/type-compatibil...

Or the type of an array and its elements:

    const arr :  number[] = [1]
but

   const this_is_actually_undefined : number = arr[456]
so it should be

    const correct_type : number | undefined = arr[idx]
And there are way more, I'm too lazy to search for them or think about them.


Ah, yes, I've stumbled about plenty of such cases – TIL that "unsoundness" is an established term for them.

Thanks so much!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: