Files
clients/libs/shared/polyfill-node-globals.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
473 B
TypeScript
Raw Permalink Normal View History

import { TextEncoder, TextDecoder } from "util";
// SDK/WASM code relies on TextEncoder/TextDecoder being available globally
// We can't use `test.environment.ts` because that breaks other tests that rely on
// the default jest jsdom environment
if (!(globalThis as any).TextEncoder) {
(globalThis as any).TextEncoder = TextEncoder;
}
if (!(globalThis as any).TextDecoder) {
(globalThis as any).TextDecoder = TextDecoder as unknown as typeof globalThis.TextDecoder;
}