Empty array (`[]`) inferred to be `never[]` instead of `[]` or `undefined[]` · Issue #51979 · microsoft/TypeScript

Bug Report I ran into this behavior where TypeScript infers that an empty array (literal []) to be of type never[], which it interprets to never happen and thus to be of no sigificance. Runtime err...

GitHub

Amazingly this is TypeScript "working as intended": https://github.com/microsoft/TypeScript/issues/51979

😜😬🫣

Empty array (`[]`) inferred to be `never[]` instead of `[]` or `undefined[]` · Issue #51979 · microsoft/TypeScript

Bug Report I ran into this behavior where TypeScript infers that an empty array (literal []) to be of type never[], which it interprets to never happen and thus to be of no sigificance. Runtime err...

GitHub