Skip to content

Commit

Permalink
feat: add TypeOperatorTypeNode#getOperator()
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Oct 30, 2021
1 parent b45d99b commit a25c851
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions deno/ts_morph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8728,6 +8728,8 @@ export declare class TypeNode<T extends ts.TypeNode = ts.TypeNode> extends Node<
}

export declare class TypeOperatorTypeNode extends TypeNode<ts.TypeOperatorNode> {
/** Gets the operator of the type node. */
getOperator(): SyntaxKind.KeyOfKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.UniqueKeyword;
/** Gets the node within the type operator. */
getTypeNode(): TypeNode;
/** @inheritdoc **/
Expand Down
3 changes: 3 additions & 0 deletions deno/ts_morph.js
Original file line number Diff line number Diff line change
Expand Up @@ -15135,6 +15135,9 @@ class TypeLiteralNode extends TypeLiteralNodeBase {
}

class TypeOperatorTypeNode extends TypeNode {
getOperator() {
return this.compilerNode.operator;
}
getTypeNode() {
return this._getNodeFromCompilerNode(this.compilerNode.type);
}
Expand Down
2 changes: 2 additions & 0 deletions packages/ts-morph/lib/ts-morph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8728,6 +8728,8 @@ export declare class TypeNode<T extends ts.TypeNode = ts.TypeNode> extends Node<
}

export declare class TypeOperatorTypeNode extends TypeNode<ts.TypeOperatorNode> {
/** Gets the operator of the type node. */
getOperator(): SyntaxKind.KeyOfKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.UniqueKeyword;
/** Gets the node within the type operator. */
getTypeNode(): TypeNode;
/** @inheritdoc **/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { ts } from "@ts-morph/common";
import { TypeNode } from "./TypeNode";

export class TypeOperatorTypeNode extends TypeNode<ts.TypeOperatorNode> {
/**
* Gets the node within the type operator.
*/
/** Gets the operator of the type node. */
getOperator() {
return this.compilerNode.operator;
}

/** Gets the node within the type operator. */
getTypeNode(): TypeNode {
return this._getNodeFromCompilerNode(this.compilerNode.type);
}
Expand Down

0 comments on commit a25c851

Please sign in to comment.