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