-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
TypeScript Version: 2.2.1
Effective type of argument p below seems to not match explicit declaration under tsc 2.2.1
Code
interface RuleContext {
_parent: RuleContext | undefined;
};
var _ctx = { _parent: undefined};
function walk( p: RuleContext | undefined = _ctx ) {
while (p) {
p = p._parent; // Error w/ "strictNullChecks": true !
}
}Expected behavior:
Compiled w/o error under 2.1
Actual behavior:
Generates error:
index.ts(9,4): error TS2322: Type 'RuleContext | undefined' is not assignable to type 'RuleContext'.
Type 'undefined' is not assignable to type 'RuleContext'.
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