[paper] Fix toJSON return type (#35806)

This commit is contained in:
Михайлов Антон
2019-05-30 10:56:55 -07:00
committed by Sheetal Nandi
parent 13e317fe33
commit bb632389a0
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ declare module paper {
/**
* Same as `exportJSON({ asString: false })`.
*/
toJSON(): string;
toJSON(): object | any[];
}
/**
+3 -1
View File
@@ -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);
}
}