@rehearsal/ts-utils
Advanced tools
Comparing version 3.0.4-beta to 3.0.5-beta
/** | ||
* This file contains helper functions to work with Typescript AST nodes and diagnostics | ||
*/ | ||
import type { DiagnosticWithLocation, Node, SourceFile, TypeChecker, TypeNode } from 'typescript'; | ||
import type { Node, SourceFile, TypeChecker, TypeNode } from 'typescript'; | ||
/** | ||
@@ -10,6 +10,2 @@ * Checks if node starts with `start` position and its length equals to `length`. | ||
/** | ||
* Checks if node is the node related to diagnostic. | ||
*/ | ||
export declare function isNodeDiagnosed(node: Node, diagnostic: DiagnosticWithLocation): boolean; | ||
/** | ||
* Checks if node is the first in the line. | ||
@@ -26,7 +22,2 @@ * e.g. for the node `revert` of `function revert(...)` the `function` is the first in the line. | ||
/** | ||
* Finds the first node in the line. | ||
* e.g. in `function revert(...)` the `revert` node has `function` node is the first in the line. | ||
*/ | ||
export declare function findTheFirstParentNodeInTheLine(node: Node): Node; | ||
/** | ||
* Checks if the node is the part of JSX Text (Element or Fragment) | ||
@@ -33,0 +24,0 @@ */ |
@@ -13,8 +13,2 @@ /** | ||
/** | ||
* Checks if node is the node related to diagnostic. | ||
*/ | ||
export function isNodeDiagnosed(node, diagnostic) { | ||
return isNodeAtPosition(node, diagnostic.start, diagnostic.length); | ||
} | ||
/** | ||
* Checks if node is the first in the line. | ||
@@ -62,10 +56,2 @@ * e.g. for the node `revert` of `function revert(...)` the `function` is the first in the line. | ||
/** | ||
* Finds the first node in the line. | ||
* e.g. in `function revert(...)` the `revert` node has `function` node is the first in the line. | ||
*/ | ||
export function findTheFirstParentNodeInTheLine(node) { | ||
const visit = (node) => isTheFirstParentNodeInTheLIne(node) ? node : visit(node.parent); | ||
return visit(node); | ||
} | ||
/** | ||
* Checks if the node is the part of JSX Text (Element or Fragment) | ||
@@ -110,3 +96,4 @@ */ | ||
}; | ||
return isTypeNodeStrict(checker, typeNode) && !typeArguments.find((node) => !canTypeBeResolved(checker, node)); | ||
return (isTypeNodeStrict(checker, typeNode) && | ||
!typeArguments.find((node) => !canTypeBeResolved(checker, node))); | ||
} | ||
@@ -113,0 +100,0 @@ if (ts.isParenthesizedTypeNode(typeNode)) { |
{ | ||
"name": "@rehearsal/ts-utils", | ||
"version": "3.0.4-beta", | ||
"version": "3.0.5-beta", | ||
"description": "Rehearsal TypeScript Utils", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
79155
381