mirror of https://github.com/vuejs/core.git
parent
a88295dc07
commit
32262a9af5
|
@ -145,7 +145,7 @@ export function trigger(
|
||||||
resetScheduling()
|
resetScheduling()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDepFromReactive(object: any, key: string | number | symbol) {
|
export function getDepFromReactive(object: any, key: PropertyKey) {
|
||||||
const depsMap = targetMap.get(object)
|
const depsMap = targetMap.get(object)
|
||||||
return depsMap && depsMap.get(key)
|
return depsMap && depsMap.get(key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ export function defineSlots<
|
||||||
return null as any
|
return null as any
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ModelRef<T, M extends string | number | symbol = string> = Ref<T> &
|
export type ModelRef<T, M extends PropertyKey = string> = Ref<T> &
|
||||||
[ModelRef<T, M>, Record<M, true | undefined>]
|
[ModelRef<T, M>, Record<M, true | undefined>]
|
||||||
|
|
||||||
export type DefineModelOptions<T = any> = {
|
export type DefineModelOptions<T = any> = {
|
||||||
|
@ -256,24 +256,24 @@ export type DefineModelOptions<T = any> = {
|
||||||
* const count = defineModel<number>('count', { default: 0 })
|
* const count = defineModel<number>('count', { default: 0 })
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export function defineModel<T, M extends string | number | symbol = string>(
|
export function defineModel<T, M extends PropertyKey = string>(
|
||||||
options: { required: true } & PropOptions<T> & DefineModelOptions<T>,
|
options: { required: true } & PropOptions<T> & DefineModelOptions<T>,
|
||||||
): ModelRef<T, M>
|
): ModelRef<T, M>
|
||||||
export function defineModel<T, M extends string | number | symbol = string>(
|
export function defineModel<T, M extends PropertyKey = string>(
|
||||||
options: { default: any } & PropOptions<T> & DefineModelOptions<T>,
|
options: { default: any } & PropOptions<T> & DefineModelOptions<T>,
|
||||||
): ModelRef<T, M>
|
): ModelRef<T, M>
|
||||||
export function defineModel<T, M extends string | number | symbol = string>(
|
export function defineModel<T, M extends PropertyKey = string>(
|
||||||
options?: PropOptions<T> & DefineModelOptions<T>,
|
options?: PropOptions<T> & DefineModelOptions<T>,
|
||||||
): ModelRef<T | undefined, M>
|
): ModelRef<T | undefined, M>
|
||||||
export function defineModel<T, M extends string | number | symbol = string>(
|
export function defineModel<T, M extends PropertyKey = string>(
|
||||||
name: string,
|
name: string,
|
||||||
options: { required: true } & PropOptions<T> & DefineModelOptions<T>,
|
options: { required: true } & PropOptions<T> & DefineModelOptions<T>,
|
||||||
): ModelRef<T, M>
|
): ModelRef<T, M>
|
||||||
export function defineModel<T, M extends string | number | symbol = string>(
|
export function defineModel<T, M extends PropertyKey = string>(
|
||||||
name: string,
|
name: string,
|
||||||
options: { default: any } & PropOptions<T> & DefineModelOptions<T>,
|
options: { default: any } & PropOptions<T> & DefineModelOptions<T>,
|
||||||
): ModelRef<T, M>
|
): ModelRef<T, M>
|
||||||
export function defineModel<T, M extends string | number | symbol = string>(
|
export function defineModel<T, M extends PropertyKey = string>(
|
||||||
name: string,
|
name: string,
|
||||||
options?: PropOptions<T> & DefineModelOptions<T>,
|
options?: PropOptions<T> & DefineModelOptions<T>,
|
||||||
): ModelRef<T | undefined, M>
|
): ModelRef<T | undefined, M>
|
||||||
|
|
|
@ -102,11 +102,11 @@ export type CompatVue = Pick<App, 'version' | 'component' | 'directive'> & {
|
||||||
/**
|
/**
|
||||||
* @deprecated Vue 3 no longer needs set() for adding new properties.
|
* @deprecated Vue 3 no longer needs set() for adding new properties.
|
||||||
*/
|
*/
|
||||||
set(target: any, key: string | number | symbol, value: any): void
|
set(target: any, key: PropertyKey, value: any): void
|
||||||
/**
|
/**
|
||||||
* @deprecated Vue 3 no longer needs delete() for property deletions.
|
* @deprecated Vue 3 no longer needs delete() for property deletions.
|
||||||
*/
|
*/
|
||||||
delete(target: any, key: string | number | symbol): void
|
delete(target: any, key: PropertyKey): void
|
||||||
/**
|
/**
|
||||||
* @deprecated use `reactive` instead.
|
* @deprecated use `reactive` instead.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -55,7 +55,7 @@ export interface KeepAliveProps {
|
||||||
max?: number | string
|
max?: number | string
|
||||||
}
|
}
|
||||||
|
|
||||||
type CacheKey = string | number | symbol | ConcreteComponent
|
type CacheKey = PropertyKey | ConcreteComponent
|
||||||
type Cache = Map<CacheKey, VNode>
|
type Cache = Map<CacheKey, VNode>
|
||||||
type Keys = Set<CacheKey>
|
type Keys = Set<CacheKey>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import type { NormalizedProps } from '../componentProps'
|
||||||
import { watchSyncEffect } from '../apiWatch'
|
import { watchSyncEffect } from '../apiWatch'
|
||||||
|
|
||||||
export function useModel<
|
export function useModel<
|
||||||
M extends string | number | symbol,
|
M extends PropertyKey,
|
||||||
T extends Record<string, any>,
|
T extends Record<string, any>,
|
||||||
K extends keyof T,
|
K extends keyof T,
|
||||||
>(props: T, name: K, options?: DefineModelOptions<T[K]>): ModelRef<T[K], M>
|
>(props: T, name: K, options?: DefineModelOptions<T[K]>): ModelRef<T[K], M>
|
||||||
|
|
|
@ -1908,7 +1908,7 @@ function baseCreateRenderer(
|
||||||
const s2 = i // next starting index
|
const s2 = i // next starting index
|
||||||
|
|
||||||
// 5.1 build key:index map for newChildren
|
// 5.1 build key:index map for newChildren
|
||||||
const keyToNewIndexMap: Map<string | number | symbol, number> = new Map()
|
const keyToNewIndexMap: Map<PropertyKey, number> = new Map()
|
||||||
for (i = s2; i <= e2; i++) {
|
for (i = s2; i <= e2; i++) {
|
||||||
const nextChild = (c2[i] = optimized
|
const nextChild = (c2[i] = optimized
|
||||||
? cloneIfMounted(c2[i] as VNode)
|
? cloneIfMounted(c2[i] as VNode)
|
||||||
|
|
|
@ -112,7 +112,7 @@ export type VNodeHook =
|
||||||
|
|
||||||
// https://github.com/microsoft/TypeScript/issues/33099
|
// https://github.com/microsoft/TypeScript/issues/33099
|
||||||
export type VNodeProps = {
|
export type VNodeProps = {
|
||||||
key?: string | number | symbol
|
key?: PropertyKey
|
||||||
ref?: VNodeRef
|
ref?: VNodeRef
|
||||||
ref_for?: boolean
|
ref_for?: boolean
|
||||||
ref_key?: string
|
ref_key?: string
|
||||||
|
@ -162,7 +162,7 @@ export interface VNode<
|
||||||
|
|
||||||
type: VNodeTypes
|
type: VNodeTypes
|
||||||
props: (VNodeProps & ExtraProps) | null
|
props: (VNodeProps & ExtraProps) | null
|
||||||
key: string | number | symbol | null
|
key: PropertyKey | null
|
||||||
ref: VNodeNormalizedRef | null
|
ref: VNodeNormalizedRef | null
|
||||||
/**
|
/**
|
||||||
* SFC only. This is assigned on vnode creation using currentScopeId
|
* SFC only. This is assigned on vnode creation using currentScopeId
|
||||||
|
|
|
@ -1390,7 +1390,7 @@ type EventHandlers<E> = {
|
||||||
import type { VNodeRef } from '@vue/runtime-core'
|
import type { VNodeRef } from '@vue/runtime-core'
|
||||||
|
|
||||||
export type ReservedProps = {
|
export type ReservedProps = {
|
||||||
key?: string | number | symbol
|
key?: PropertyKey
|
||||||
ref?: VNodeRef
|
ref?: VNodeRef
|
||||||
ref_for?: boolean
|
ref_for?: boolean
|
||||||
ref_key?: string
|
ref_key?: string
|
||||||
|
|
Loading…
Reference in New Issue