import {Injectable} from '@angular/core'; import * as NativePunycode from 'punycode'; import * as NativeQuotedPrintable from 'quoted-printable'; import * as NativeUtf8 from 'utf8'; @Injectable({ providedIn: 'root' }) export class NativeLibraryWrapperService { public readonly utf8: Utf8; public readonly quotedPrintable: QuotedPrintable; public readonly punycode: Punycode; constructor() { this.utf8 = NativeUtf8; this.quotedPrintable = NativeQuotedPrintable; this.punycode = NativePunycode; } } interface Punycode { encode(input: string): string; decode(input: string): string; } interface QuotedPrintable { encode(input: string): string; decode(input: string): string; } interface Utf8 { encode(input: any): string; decode(input: string): any; }