Skip to content

Some global symbols not available on globalThis #9957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kitsonk opened this issue Apr 1, 2021 · 2 comments · Fixed by #12497
Closed

Some global symbols not available on globalThis #9957

kitsonk opened this issue Apr 1, 2021 · 2 comments · Fixed by #12497
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Apr 1, 2021

This issue isn't fixed for other symbols declared with declare class, which I think we decided to favour in the past. Seems like only declare var is accessible on globalThis, I think we need an upstream solution: microsoft/TypeScript#39504. cc @caspervonb @kitsonk

Originally posted by @nayeemrmn in #5666 (comment)

@kitsonk kitsonk added bug Something isn't working correctly cli related to cli/ dir labels Apr 1, 2021
@sandersn
Copy link

sandersn commented Apr 6, 2021

In microsoft/TypeScript#39504, @ExE-Boss points out that declare class can't be accessible on globalThis because it contradicts JS semantics. Experimentation with V8 shows that it implements the semantics the same way.

@nayeemrmn
Copy link
Contributor

@sandersn As similarly discussed in that issue we are looking for some other way to declare a class object which is accessible from globalThis e.g. declare var Foo: typeof class Foo {} doesn't work. A var class Foo {} syntax is proposed there.

Note that we specifically want to use class instead of

interface Foo {}
declare var Foo: {
  prototype: Foo;
  new(): Foo;
}

(even for web APIs where it isn't accurate) because it looks better in our generated docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants