'TSlint Warning: deprecation atob is deprecated: Use `Buffer.from(data, 'base64')` instead

I have this warning when run lint on my project:

deprecation atob is deprecated: Use Buffer.from(data, 'base64') instead.

I´m trying to solve this warning by replace this line:

return JSON.parse(atob(token.split('.')[1]));

with the suggested solution showed in the console:

return JSON.parse(Buffer.from(token.split('.')[1],"base64"));

However, when debugging it shows the following error enter image description here

How can i solve this problem? I´m using node 14!



Solution 1:[1]

Fixed after changing:

declare const Buffer: { from: (arg0: string, arg1: string) => string; };

to

import { Buffer } from 'buffer';

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1