mirror of
https://github.com/konvajs/konva.git
synced 2026-01-24 05:45:14 +08:00
Fix typings in signatures of findAncestor(s)
In TypeScript, optional arguments must be declared as such.
This commit is contained in:
@@ -1497,7 +1497,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
||||
* // get one of the parent group
|
||||
* var parentGroups = node.findAncestors('Group');
|
||||
*/
|
||||
findAncestors(selector, includeSelf, stopNode) {
|
||||
findAncestors(selector?, includeSelf?, stopNode?) {
|
||||
var res: Array<Node> = [];
|
||||
|
||||
if (includeSelf && this._isMatch(selector)) {
|
||||
@@ -1530,7 +1530,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
||||
* // get one of the parent group
|
||||
* var group = node.findAncestors('.mygroup');
|
||||
*/
|
||||
findAncestor(selector, includeSelf, stopNode) {
|
||||
findAncestor(selector?, includeSelf?, stopNode?) {
|
||||
return this.findAncestors(selector, includeSelf, stopNode)[0];
|
||||
}
|
||||
// is current node match passed selector?
|
||||
|
||||
Reference in New Issue
Block a user