TypeScript
TypeScript copied to clipboard
`atob()` is incorrectly marked as deprecated.
Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: 1.60.0
- OS Version: Windows 7
Steps to Reproduce:
- Reference the
atob()
function in a JavaScript or TypeScript file. - The reference to the function is marked as deprecated, even if only the unintended one of its two overloads is.
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 😕
See https://github.com/microsoft/TypeScript/issues/842 for more info. window.atob()
is a workaround mentioned there.
I was able to fix by using window.btoa
instead of btoa
.