Procházet zdrojové kódy

Support Vue.delete(arr, index) in TypeScript definitions (#5508)

* add a variation of 'delete' to typesript typings, added in 2.2+

* add typescript typings test for Vue.delete(arr, index)
Async0x42 před 9 roky
rodič
revize
1288386722
2 změnil soubory, kde provedl 2 přidání a 0 odebrání
  1. 1 0
      types/test/vue-test.ts
  2. 1 0
      types/vue.d.ts

+ 1 - 0
types/test/vue-test.ts

@@ -78,6 +78,7 @@ class Test extends Vue {
     this.set({}, "", "");
     this.set([true, false, true], 1, true);
     this.delete({}, "");
+    this.delete([true, false], 0);
     this.directive("", {bind() {}});
     this.filter("", (value: number) => value);
     this.component("", { data: () => ({}) });

+ 1 - 0
types/vue.d.ts

@@ -84,6 +84,7 @@ export declare class Vue {
   static set<T>(object: Object, key: string, value: T): T;
   static set<T>(array: T[], key: number, value: T): T;
   static delete(object: Object, key: string): void;
+  static delete<T>(array: T[], key: number): void;
 
   static directive(
     id: string,