Closed
Description
π Search Terms
presence of export narrowing typescript typecheck type checking export statement
π Version & Regression Information
- This changed between versions 5.4.5 and 5.5.3
β― Playground Link
π» Code
const x: Partial<Record<number, {a: string}>> = {};
let i = 5;
if(x[i]) {
x[i].a = 'hello';
}
// try un-commenting this line
// export const unrelatedThing = 4;
π Actual behavior
The type narrowing for an index type did not work unless an export
was included.
π Expected behavior
The export
should not affect the compilation or typechecking of a file at all.
Additional information about the issue
This could possibly be a bug with just the TS playground; I did not test it on my machine.
Metadata
Metadata
Assignees
Labels
No labels