Skip to content

Commit 0ba79e2

Browse files
nel215yyx990803
authored andcommitted
fix(types): accept number type as key on Vue.set/delete (#8707) (#8709)
1 parent ac217d2 commit 0ba79e2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

types/test/vue-test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ class Test extends Vue {
8787
this.nextTick(() => {});
8888
this.nextTick().then(() => {});
8989
this.set({}, "", "");
90+
this.set({}, 1, "");
9091
this.set([true, false, true], 1, true);
9192
this.delete({}, "");
93+
this.delete({}, 1);
9294
this.delete([true, false], 0);
9395
this.directive("", {bind() {}});
9496
this.filter("", (value: number) => value);

types/vue.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ export interface VueConstructor<V extends Vue = Vue> {
9191

9292
nextTick(callback: () => void, context?: any[]): void;
9393
nextTick(): Promise<void>
94-
set<T>(object: object, key: string, value: T): T;
94+
set<T>(object: object, key: string | number, value: T): T;
9595
set<T>(array: T[], key: number, value: T): T;
96-
delete(object: object, key: string): void;
96+
delete(object: object, key: string | number): void;
9797
delete<T>(array: T[], key: number): void;
9898

9999
directive(

0 commit comments

Comments
 (0)