Skip to content

A type can be named undefined  #57573

@dragomirtitian

Description

@dragomirtitian

🔎 Search Terms

type named undefined

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ

⏯ Playground Link

Playground Link

💻 Code

namespace ns {
    export type undefined = "";
    export function x(p: undefined): undefined { // global undefined
        
    }
}

function x(p: ns.undefined) { // undefined from the namespace

}

🙁 Actual behavior

Inside the namespace undefined is the global undefined type. We can access the type if we qualify it with the namespace

🙂 Expected behavior

undefined should not be allowed as a type name. (null is not)

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions