From c8b901e452b99fbba8ba3dca6801634e6ac3e64b Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 28 Mar 2018 15:51:09 +0200 Subject: [PATCH] Include the notifySplices method, and also add a trivial test for the ArraySplice function with mutable and immutable arrays. --- types/polymer/index.d.ts | 2 ++ types/polymer/polymer-tests.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/types/polymer/index.d.ts b/types/polymer/index.d.ts index c206c08927..a4eca3e70b 100644 --- a/types/polymer/index.d.ts +++ b/types/polymer/index.d.ts @@ -139,6 +139,8 @@ declare global { unshift?(path: string, ...item: any[]): number; + notifySplices?(path: string, splices: ReadonlyArray): void; + // ResolveUrl resolveUrl?(url: string): string; diff --git a/types/polymer/polymer-tests.ts b/types/polymer/polymer-tests.ts index dcad66f871..2b6631ffb7 100644 --- a/types/polymer/polymer-tests.ts +++ b/types/polymer/polymer-tests.ts @@ -82,3 +82,11 @@ class MyElement3 implements polymer.Base { } Polymer(MyElement3); + +// Test splice computation +const splices: polymer.PolymerSplice[] = Polymer.ArraySplice.calculateSplices( + [1,2,3], [1,2]); + +// Test that readonly arrays also work. +const splices2: polymer.PolymerSplice[] = Polymer.ArraySplice.calculateSplices( + Object.freeze([1,2,3]), Object.freeze([1,2]));