Skip to content
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

TextEncoder doesn't exist on type of globalThis #5666

Closed
bartlomieju opened this issue May 20, 2020 · 4 comments · Fixed by #9782
Closed

TextEncoder doesn't exist on type of globalThis #5666

bartlomieju opened this issue May 20, 2020 · 4 comments · Fixed by #9782
Labels
bug Something isn't working correctly

Comments

@bartlomieju
Copy link
Member

// main.ts
console.log(globalThis.TextEncoder);
$ deno run main.ts
Compile file:///Users/biwanczuk/dev/deno/main.ts
error: TS2339 [ERROR]: Property 'TextEncoder' does not exist on type 'typeof globalThis'.
console.log(globalThis.TextEncoder);
                       ~~~~~~~~~~~
    at file:///Users/biwanczuk/dev/deno/main.ts:1:24

I'd expect that TextEncoder/TextDecoder would be available on the globalThis type.

Ref #5663

@bartlomieju bartlomieju added the bug Something isn't working correctly label May 20, 2020
@bartlomieju
Copy link
Member Author

Still valid, lib.deno.window.d.ts and lib.deno.worker.d.ts type declarations should be updated to reflect those values.

@nayeemrmn
Copy link
Collaborator

nayeemrmn 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

@kitsonk
Copy link
Contributor

kitsonk commented Apr 2, 2021

#9782 was reverted

@kitsonk kitsonk reopened this Apr 2, 2021
@bartlomieju
Copy link
Member Author

Closing in favor of #9957

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants