From 0ba79e2588309ba386f570ed84d372611c4dd165 Mon Sep 17 00:00:00 2001 From: nel215 Date: Fri, 30 Nov 2018 20:28:52 -0800 Subject: [PATCH] fix(types): accept `number` type as key on Vue.set/delete (#8707) (#8709) --- types/test/vue-test.ts | 2 ++ types/vue.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/test/vue-test.ts b/types/test/vue-test.ts index 6fe0e561..72390b08 100644 --- a/types/test/vue-test.ts +++ b/types/test/vue-test.ts @@ -87,8 +87,10 @@ class Test extends Vue { this.nextTick(() => {}); this.nextTick().then(() => {}); this.set({}, "", ""); + this.set({}, 1, ""); this.set([true, false, true], 1, true); this.delete({}, ""); + this.delete({}, 1); this.delete([true, false], 0); this.directive("", {bind() {}}); this.filter("", (value: number) => value); diff --git a/types/vue.d.ts b/types/vue.d.ts index 29667ead..44a892ea 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -91,9 +91,9 @@ export interface VueConstructor { nextTick(callback: () => void, context?: any[]): void; nextTick(): Promise - set(object: object, key: string, value: T): T; + set(object: object, key: string | number, value: T): T; set(array: T[], key: number, value: T): T; - delete(object: object, key: string): void; + delete(object: object, key: string | number): void; delete(array: T[], key: number): void; directive(