Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instanceof narrowing inference not working on references #5702

Closed
idoros opened this issue Nov 17, 2015 · 1 comment
Closed

instanceof narrowing inference not working on references #5702

idoros opened this issue Nov 17, 2015 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@idoros
Copy link

idoros commented Nov 17, 2015

var htmlElement:HTMLElement = getElement()

// 
var offsetParent = htmlElement.offsetParent;
if(offsetParent instanceof HTMLElement){
    htmlElement = offsetParent; // OK!
}

// alternatively this will cause an error:
if(htmlElement.offsetParent instanceof HTMLElement){
    htmlElement = htmlElement.offsetParent; // ERROR: Assigned expression type Element is not assignable to type HTMLElement 
}
@idoros idoros changed the title reference instanceof narrowing inference not working on references instanceof narrowing inference not working on references Nov 20, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Dec 2, 2015

looks like a duplicate of #1260

@mhegazy mhegazy closed this as completed Dec 2, 2015
@mhegazy mhegazy added the Duplicate An existing issue was already created label Dec 2, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants