I need to use some core-js@3 polyfills from within TypeScript. However, @types/core-js
provides definitions for [email protected] only, and it seems that core-js@3 is sufficiently different from 2 that most type definitions are outdated.
Is there some accepted workaround to this?
A shim can help here. For instance, if you need typings for structuredClone
:
// shims/core-js.d.ts
declare module 'core-js/actual/structured-clone' {
export default function structuredClone<T>(value: T): T;
}
Note: This omits the transfer
property as it's not something I personally intend to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With