TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

`atob()` is incorrectly marked as deprecated.

Open infinnie opened this issue 3 years ago • 3 comments

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.60.0
  • OS Version: Windows 7

image

Steps to Reproduce:

  1. Reference the atob() function in a JavaScript or TypeScript file.
  2. The reference to the function is marked as deprecated, even if only the unintended one of its two overloads is.

infinnie avatar Aug 24 '21 03:08 infinnie

The problem is that the two "overloads" are identical in signature, and the deprecated one from node is being picked because it was loaded last. If you’re writing DOM code, you should really try to avoid having node typings in your program, but we are painfully aware this is much easier said than done, and sometimes impossible. You may be able to exclude it via some tsconfig/jsconfig settings, but you may not, depending on your dependencies. You’ll have similar issues with the return type of setTimeout, and we’re just not able to fix that from our end right now. I don’t think we can actually do anything about the deprecated suggestion either, for the same reason 😕

andrewbranch avatar Aug 25 '21 00:08 andrewbranch

See https://github.com/microsoft/TypeScript/issues/842 for more info. window.atob() is a workaround mentioned there.

andrewbranch avatar Aug 25 '21 00:08 andrewbranch

I was able to fix by using window.btoa instead of btoa.

devinrhode2 avatar Nov 03 '22 19:11 devinrhode2