-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
Filing an issue to track the regression from #26143 described in #26143 (comment).
TypeScript Version: master (fe387cc)
Search Terms: narrow assignment weak type assignable comparable
Code
type AOrArrA<T> = T | T[];
const arr: AOrArrA<{x?: "ok"}> = [{ x: "ok" }]; // weak type
arr.push({ x: "ok" }); // Error: Property 'push' does not exist on type 'AOrArrA<{ x?: "ok"; }>'.
Expected behavior: No error.
Actual behavior: Error as indicated above.
Playground Link: N/A, playground is not affected
Related Issues: #26143
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue