-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
Hello, using VS Code to have typed JS (checkJs: true), but it seems to be having troubles with intersection types that work in both TS and JS in TS Playground without any error. Interestingly enough, properties from a second intersected type are correctly detected by VS Code despite the error on assignment of the typed value (see intellisence tooltip on the screenshot in Actual behavior).
TypeScript Version: 3.9.0-dev.20200420
Search Terms:
not assignable, Intersection types
Code
const ExtraProps = {
one: 1,
two: 2
}
class Test { }
/** @type {Test & ExtraProps} */
const inst = new Test();
inst.one; // no complains
Assigning a properly defined type also does not work:
/**
* @typedef {{[x in "one"|"two"]: number}} ExtraPropsType
*/
/** @type {Test & ExtraPropsType} */
const inst = new Test();
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone

