-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
TypeScript Version: playground
Code
type unknown = {} | undefined | null | void;
interface Dict {
[key: string]: unknown;
}
function isDict(value: any): value is Dict {
return value !== null && value !== undefined;
}
function any(): any {
}
let notSure: unknown = any();
if (isDict(notSure)) {
notSure['foo']; // <- turn on strict mode to see error, `notSure` is `{}`
}
Expected behavior:
notSure
is Dict
after the narrowing
Actual behavior:
notSure
is {}
after the narrowing
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed