From bcb8aca650e2fac15489fd94fee15c83ea945cad Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Mon, 16 Dec 2024 12:56:01 +0100 Subject: [PATCH] polyfill `Symbol.dispose` and `Symbol.asyncDispose` --- packages/@tailwindcss-node/src/instrumentation.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/@tailwindcss-node/src/instrumentation.ts b/packages/@tailwindcss-node/src/instrumentation.ts index 2928d9c42fed..d27858d888bd 100644 --- a/packages/@tailwindcss-node/src/instrumentation.ts +++ b/packages/@tailwindcss-node/src/instrumentation.ts @@ -1,6 +1,12 @@ import { DefaultMap } from '../../tailwindcss/src/utils/default-map' import * as env from './env' +// See: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#:~:text=Symbol.dispose,-??=%20Symbol(%22Symbol.dispose +// @ts-expect-error — Ensure Symbol.dispose exists +Symbol.dispose ??= Symbol('Symbol.dispose') +// @ts-expect-error — Ensure Symbol.asyncDispose exists +Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose') + export class Instrumentation implements Disposable { #hits = new DefaultMap(() => ({ value: 0 })) #timers = new DefaultMap(() => ({ value: 0n }))