Skip to content

InstanceOf incorrectly narrow when parameter contains type parameter #10423

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

Closed
yuit opened this issue Aug 18, 2016 · 1 comment
Closed

InstanceOf incorrectly narrow when parameter contains type parameter #10423

yuit opened this issue Aug 18, 2016 · 1 comment
Labels
Bug A bug in TypeScript Duplicate An existing issue was already created

Comments

@yuit
Copy link
Contributor

yuit commented Aug 18, 2016

Version: master

class Node { name: string; }
class NodeList extends Node { }

function f<T extends Node>(n: T) {
    if (!(n instanceof NodeList)) {
        n // Never, but should be Node
    }
} 
@yuit yuit added the Bug A bug in TypeScript label Aug 18, 2016
@yuit
Copy link
Contributor Author

yuit commented Aug 19, 2016

This is a duplicate of #10422

@yuit yuit closed this as completed Aug 19, 2016
@yuit yuit added the Duplicate An existing issue was already created label Aug 19, 2016
@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
Bug A bug in TypeScript Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

1 participant