CodeZettaInterview Hub

TypeScript · Type Inference · Junior · Debugging

Why does let x = [] become any[]?

Short Interview Answer

Insufficient elements to infer; widens unsafely without context.

Detailed Explanation

Annotate as string[] or use as const / satisfies. noImplicitAny helps catch.

Did you know this answer?