From bb632389a01ebfcc81e0a31fc0f8a5d2043254f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2=20=D0=90?= =?UTF-8?q?=D0=BD=D1=82=D0=BE=D0=BD?= Date: Thu, 30 May 2019 22:56:55 +0500 Subject: [PATCH] [paper] Fix toJSON return type (#35806) --- types/paper/index.d.ts | 2 +- types/paper/paper-tests.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 4266ca0be7..115175fa3f 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -74,7 +74,7 @@ declare module paper { /** * Same as `exportJSON({ asString: false })`. */ - toJSON(): string; + toJSON(): object | any[]; } /** diff --git a/types/paper/paper-tests.ts b/types/paper/paper-tests.ts index 6860037e70..efa01b5d69 100644 --- a/types/paper/paper-tests.ts +++ b/types/paper/paper-tests.ts @@ -15281,9 +15281,11 @@ function APIReferenceExamples() { const str = src.exportJSON(); // "['Point', 50, 25]" // not type save import const res0 = paper.Point.importJSON(str); + // not type save import + const res1 = paper.Point.importJSON(src.toJSON()); // type save import to existing object // if object is not same type with json, object will not be updated - const res1 = new paper.Point(0, 0); + const res2 = new paper.Point(0, 0); paper.Point.importJSON(str, res1); } }