types fixes. close #945

This commit is contained in:
Anton Lavrenov 2020-07-06 10:20:47 -05:00
parent 4e1b1c7812
commit 8bf97ba8c1
4 changed files with 53 additions and 1323 deletions

View File

@ -3,6 +3,9 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
* Fix incorrect text rendering with `letterSpacing !== 0`
* Typescript fixes
## 7.0.2 - 2020-06-30
* Fix wrong trigger `dbltap` and `click` on mobile

1364
konva.js

File diff suppressed because it is too large Load Diff

View File

@ -219,7 +219,7 @@ export abstract class Container<ChildType extends Node> extends Node<
* return node.getType() === 'Shape'
* })
*/
findOne<ChildNode extends Node = Node>(selector: string | Function): Node {
findOne<ChildNode extends Node = Node>(selector: string | Function) {
var result = this._generalFind<ChildNode>(selector, true);
return result.length > 0 ? result[0] : undefined;
}
@ -227,9 +227,9 @@ export abstract class Container<ChildType extends Node> extends Node<
selector: string | Function,
findOne: boolean
) {
var retArr: Array<Node> = [];
var retArr: Array<ChildNode> = [];
this._descendants((node) => {
this._descendants((node: ChildNode) => {
const valid = node._isMatch(selector);
if (valid) {
retArr.push(node);
@ -240,7 +240,7 @@ export abstract class Container<ChildType extends Node> extends Node<
return false;
});
return Collection.toCollection(retArr);
return Collection.toCollection<ChildNode>(retArr);
}
private _descendants(fn: (n: Node) => boolean) {
let shouldStop = false;

View File

@ -3,6 +3,7 @@ import { Container } from './Container';
import { _registerNode } from './Global';
import { Node } from './Node';
import { Shape } from './Shape';
import Konva from './index-types';
/**
* Group constructor. Groups are used to contain shapes or other groups.