Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated typing of key in VNodeProps (fix #4240) #4242

Merged
merged 1 commit into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/runtime-core/src/components/KeepAlive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface KeepAliveProps {
max?: number | string
}

type CacheKey = string | number | ConcreteComponent
type CacheKey = string | number | symbol | ConcreteComponent
type Cache = Map<CacheKey, VNode>
type Keys = Set<CacheKey>

Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ function baseCreateRenderer(
const s2 = i // next starting index

// 5.1 build key:index map for newChildren
const keyToNewIndexMap: Map<string | number, number> = new Map()
const keyToNewIndexMap: Map<string | number | symbol, number> = new Map()
for (i = s2; i <= e2; i++) {
const nextChild = (c2[i] = optimized
? cloneIfMounted(c2[i] as VNode)
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime-core/src/vnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down