chore: Inline some trivial private methods (#946)

This commit is contained in:
absidue
2025-04-06 18:37:57 +02:00
committed by GitHub
parent 95d9211eae
commit 14ea875c67
2 changed files with 7 additions and 23 deletions

View File

@@ -11,22 +11,13 @@ export class YTNode {
this.type = (this.constructor as YTNodeConstructor).type;
}
/**
* Check if the node is of the given type.
* @param type - The type to check
* @returns whether the node is of the given type
*/
#is<T extends YTNode>(type: YTNodeConstructor<T>): this is T {
return this.type === type.type;
}
/**
* Check if the node is of the given type.
* @param types - The type to check
* @returns whether the node is of the given type
*/
is<T extends YTNode, K extends YTNodeConstructor<T>[]>(...types: K): this is InstanceType<K[number]> {
return types.some((type) => this.#is(type));
return types.some((type) => this.type === type.type);
}
/**