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

type guards don't work over property accessors (projection operator .) #4297

Closed
zpdDG4gta8XKpMCd opened this issue Aug 13, 2015 · 2 comments
Closed
Labels
Duplicate An existing issue was already created

Comments

@zpdDG4gta8XKpMCd
Copy link

var data : { value: string | number } = { value: 'hey' };
if (typeof data.value === 'string') {
    alert(data.value.toLowerCase());  // <-- type of value is undecided 
}
@danquirk
Copy link
Member

You might also want to look at #1260

@zpdDG4gta8XKpMCd
Copy link
Author

thanks, mine is clearly a dup

@danquirk danquirk added the Duplicate An existing issue was already created label Aug 13, 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