3 ms·
https://www.typescriptlang.org/docs/handbook/type-compatibility.html#a-note-on-soundness https://www.typescriptlang.org/docs/handbook/type-compatibil... For ex
by ReleaseCandidat 3y ago
https://www.typescriptlang.org/docs/handbook/type-compatibility.html#a-note-on-soundness https://www.typescriptlang.org/docs/handbook/type-compatibil...
For example:
https://www.typescriptlang.org/docs/handbook/type-compatibility.html#function-parameter-bivariance https://www.typescriptlang.org/docs/handbook/type-compatibil...
https://www.typescriptlang.org/docs/handbook/type-compatibility.html?#optional-parameters-and-rest-parameters 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.
- codethief 3y agoAh, yes, I've stumbled about plenty of such cases – TIL that "unsoundness" is an established term for them. Thanks so much!