mirror of https://github.com/vuejs/core.git
fix(types): add fallback stub for DOM types when DOM lib is absent (#11598)
This commit is contained in:
parent
73fa91fabd
commit
fee669764f
|
@ -33,9 +33,17 @@ import type { vShow } from './directives/vShow'
|
|||
import type { VOnDirective } from './directives/vOn'
|
||||
import type { VModelDirective } from './directives/vModel'
|
||||
|
||||
/**
|
||||
* 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<T> = typeof globalThis extends { window: unknown } ? T : DomStub
|
||||
|
||||
declare module '@vue/reactivity' {
|
||||
export interface RefUnwrapBailTypes {
|
||||
runtimeDOMBailTypes: Node | Window
|
||||
runtimeDOMBailTypes: DomType<Node | Window>
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue