Skip to content

typeof a === "object" does not type the object as Object #20981

@Roaders

Description

@Roaders

Code

function doStuff(a: any) {

    if (typeof a === "object") {
        a //why isn't a typed as Object here?
    }
}

example here

Expected behavior:
in the if statement a should be typed as Object and give code completion suggestions for object (like hasOwnProperty).

Actual behavior:
a is still typed as any and no object based code completion suggestions are given.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions