Skip to content
Open
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
11 changes: 9 additions & 2 deletions src/core/observer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ export function defineReactive(
* already exist.
*/
export function set<T>(array: T[], key: number, value: T): T
export function set<T>(object: object, key: string | number, value: T): T
export function set<T extends Record<keyof any, any>, K extends keyof T>(
object: T,
key: K,
value: T[K]
): T
export function set(
target: any[] | Record<string, any>,
key: any,
Expand Down Expand Up @@ -278,7 +282,10 @@ export function set(
* Delete a property and trigger change if necessary.
*/
export function del<T>(array: T[], key: number): void
export function del(object: object, key: string | number): void
export function del<T extends Record<keyof any, any>, K extends keyof T>(
object: T,
key: K
): void
export function del(target: any[] | object, key: any) {
if (__DEV__ && (isUndef(target) || isPrimitive(target))) {
warn(
Expand Down