Skip to content

Type refinement via typeof allows refinements which do not work at runtime #2169

@stravant

Description

@stravant

The following will refine the type of container to Model but that does not actually work at runtime because typeof will yield "Instance" for a Model, not "Model":

assert(typeof(container) == "Model")

The correct code would be asserting IsA("Model") instead.

I'm guessing this may be intended behavior because it seems like it might be hard to implement it otherwise but it would be nice if it worked correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions