π Search Terms
"as const", 5.3.0, assignment
π Version & Regression Information
- This changed between versions 5.2.2 and 5.3.0 (nightly)
β― Playground Link
https://www.typescriptlang.org/play?ts=5.3.0-dev.20231016#code/PTAEAEBcGcFoFMAeAHeBjSCBOWD2XQAVACwEtpRpjcBXAGwBNQAjeUAQ1EgE9VR4c+FunY1obAAZZ47BrgB2dbqADaAFgBMAXQmhyoebkgdo0UgHN57ZnTaRcoCQEEc7bgB55NALassAPgkAKFtjRAAuUBcsN08fP39QAF5VTS0TUDQFaEgAbiCgA
π» Code
// This should be a type error because `readonly [42]` is not assignable to `Array<number>`
let x: Array<number> = [42] as const;
π Actual behavior
No type error
π Expected behavior
Type error
Additional information about the issue
No response