diff --git a/packages/runtime-core/src/components/KeepAlive.ts b/packages/runtime-core/src/components/KeepAlive.ts index 9bccf40f576..30ad4400da6 100644 --- a/packages/runtime-core/src/components/KeepAlive.ts +++ b/packages/runtime-core/src/components/KeepAlive.ts @@ -46,7 +46,7 @@ export interface KeepAliveProps { max?: number | string } -type CacheKey = string | number | ConcreteComponent +type CacheKey = string | number | symbol | ConcreteComponent type Cache = Map type Keys = Set diff --git a/packages/runtime-core/src/renderer.ts b/packages/runtime-core/src/renderer.ts index 680f0c696fe..62db9cd8cb9 100644 --- a/packages/runtime-core/src/renderer.ts +++ b/packages/runtime-core/src/renderer.ts @@ -1873,7 +1873,7 @@ function baseCreateRenderer( const s2 = i // next starting index // 5.1 build key:index map for newChildren - const keyToNewIndexMap: Map = new Map() + const keyToNewIndexMap: Map = new Map() for (i = s2; i <= e2; i++) { const nextChild = (c2[i] = optimized ? cloneIfMounted(c2[i] as VNode) diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index 18db9cf5e25..26b2ac9e423 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -90,7 +90,7 @@ export type VNodeHook = // https://github.com/microsoft/TypeScript/issues/33099 export type VNodeProps = { - key?: string | number + key?: string | number | symbol ref?: VNodeRef // vnode hooks @@ -138,7 +138,7 @@ export interface VNode< type: VNodeTypes props: (VNodeProps & ExtraProps) | null - key: string | number | null + key: string | number | symbol | null ref: VNodeNormalizedRef | null /** * SFC only. This is assigned on vnode creation using currentScopeId