Skip to content

Cannot access the globalThis namespaceΒ #42395

Closed
@juanrgm

Description

@juanrgm

Bug Report

πŸ”Ž Search Terms

root namespace, namespace collision

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about namespaces

⏯ Playground Link

https://www.typescriptlang.org/play?#code/CYUwxgNghgTiAEAXAngBwQIXgXngRgFgAoUSWBMgZ0vgGF4BvAX2NOjngDsoBbES1FDAIAgo2LxJ8EAA9UAexiIkaTDngBzCPIBGUCABUAFgEtKAOiwB6K-BPKA7ooDWlCVNkKl8KjXqzEEE5gGi1dfWMzc3pmeBt4AAUYeXQlZHgAcloM+GB5fi55ZVkzZXlOFXRMlHR5ADNNbT1DU0oM82ImIA

πŸ’» Code

declare type B = 1
declare class C {}
declare namespace A {
    export type B = globalThis.B // It works
    export class C extends globalThis.C {} // Property 'C' does not exist on type 'typeof globalThis'.
}

πŸ™ Actual behavior

Property 'C' does not exist on type 'typeof globalThis'.

It is not possible access to the root namespace.

πŸ™‚ Expected behavior

Be able to access to the root namespace.

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions