From: Tycho Date: Tue, 13 Aug 2024 14:06:10 +0000 (+0800) Subject: fix(types): add fallback stub for DOM types when DOM lib is absent (#11598) X-Git-Tag: v3.4.38~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4db0085de316e1b773f474597915f9071d6ae6c6;p=thirdparty%2Fvuejs%2Fcore.git fix(types): add fallback stub for DOM types when DOM lib is absent (#11598) --- diff --git a/packages/runtime-dom/src/index.ts b/packages/runtime-dom/src/index.ts index 44ada3d935..6b110d00a7 100644 --- a/packages/runtime-dom/src/index.ts +++ b/packages/runtime-dom/src/index.ts @@ -26,9 +26,17 @@ import { isString, } from '@vue/shared' +/** + * This is a stub implementation to prevent the need to use dom types. + * + * To enable proper types, add `"dom"` to `"lib"` in your `tsconfig.json`. + */ +type DomStub = {} +type DomType = typeof globalThis extends { window: unknown } ? T : DomStub + declare module '@vue/reactivity' { export interface RefUnwrapBailTypes { - runtimeDOMBailTypes: Node | Window + runtimeDOMBailTypes: DomType } }