2 ms·
I think I'm just confused by the examples chosen. E.g.: > type NonEmptyArray<T> = [T, ...T[]]; I'm not very familiar with Typescript, but isn't that also a "c
by valenterry 6y ago
I think I'm just confused by the examples chosen. E.g.:
> type NonEmptyArray<T> = [T, ...T[]];
I'm not very familiar with Typescript, but isn't that also a "constructive" approach, rather than a "constraining" one? It reads to me like "NonEmptyArray is an array that has one element and then more elements that come from pulling elements from another array".
Typescript uses a language construct here for a special usecase, but the point still stands.