From b37286aaa5c386598520f3730644392a98334bfc Mon Sep 17 00:00:00 2001 From: Anton Lavrenov Date: Mon, 22 Apr 2019 08:17:25 -0500 Subject: [PATCH] fix some types. close #638 --- konva.js | 2 +- konva.min.js | 2 +- src/Container.ts | 12 ++++++------ src/Util.ts | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/konva.js b/konva.js index b933005a..fb7da70f 100644 --- a/konva.js +++ b/konva.js @@ -8,7 +8,7 @@ * Konva JavaScript Framework v3.2.5 * http://konvajs.org/ * Licensed under the MIT - * Date: Wed Apr 17 2019 + * Date: Mon Apr 22 2019 * * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS) * Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva) diff --git a/konva.min.js b/konva.min.js index 1b4d5ae0..8effcbee 100644 --- a/konva.min.js +++ b/konva.min.js @@ -3,7 +3,7 @@ * Konva JavaScript Framework v3.2.5 * http://konvajs.org/ * Licensed under the MIT - * Date: Wed Apr 17 2019 + * Date: Mon Apr 22 2019 * * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS) * Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva) diff --git a/src/Container.ts b/src/Container.ts index cd1650bf..3f3473ed 100644 --- a/src/Container.ts +++ b/src/Container.ts @@ -190,10 +190,10 @@ export abstract class Container extends Node< * return node.getType() === 'Node' && node.getAbsoluteOpacity() < 1; * }); */ - find(selector) { + find(selector): Collection { // protecting _generalFind to prevent user from accidentally adding // second argument and getting unexpected `findOne` result - return this._generalFind(selector, false); + return this._generalFind(selector, false); } get(selector) { @@ -220,12 +220,12 @@ export abstract class Container extends Node< * return node.getType() === 'Shape' * }) */ - findOne(selector) { - var result = this._generalFind(selector, true); + findOne(selector): ChildNode { + var result = this._generalFind(selector, true); return result.length > 0 ? result[0] : undefined; } - _generalFind(selector, findOne) { - var retArr = []; + _generalFind(selector, findOne) { + var retArr: Array = []; this._descendants(node => { const valid = node._isMatch(selector); diff --git a/src/Util.ts b/src/Util.ts index c3c225cb..b86e54fa 100644 --- a/src/Util.ts +++ b/src/Util.ts @@ -49,8 +49,8 @@ export class Collection { * @memberof Konva.Collection * @param {Array} arr */ - static toCollection(arr: Array) { - var collection = new Collection(), + static toCollection(arr: Array) { + var collection = new Collection(), len = arr.length, n;