8000 type guards don't work over property accessors (projection operator `.`) · Issue #4297 · microsoft/TypeScript · GitHub
[go: up one dir, main page]

Skip to content
type guards don't work over property accessors (projection operator .) #4297
Closed
@zpdDG4gta8XKpMCd

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0