Utility functions for working with TypeScript's API, providing comprehensive tools for analyzing and manipulating TypeScript AST nodes, types, and compiler APIs.
79
A tool that analyzes TypeScript source code and classifies different types of nodes found in the Abstract Syntax Tree (AST).
any, boolean, number, and string type keywords, the classifier identifies and counts each type keyword category @testtrue and false literals, the classifier identifies and counts true literals and false literals separately @testpublic, private, protected, static, readonly, and abstract modifiers, the classifier identifies and counts each modifier type @test@generates
/**
* Represents the classification results for a TypeScript source file
*/
export interface ClassificationResult {
typeKeywords: {
any: number;
boolean: number;
number: number;
string: number;
null: number;
};
booleanLiterals: {
true: number;
false: number;
};
modifiers: {
public: number;
private: number;
protected: number;
static: number;
readonly: number;
abstract: number;
};
}
/**
* Analyzes a TypeScript source file and classifies the different types of nodes
*
* @param sourceCode - The TypeScript source code to analyze
* @returns A ClassificationResult object containing counts of different node types
*/
export function classifyNodes(sourceCode: string): ClassificationResult;Provides type guard functions for TypeScript AST nodes.
@satisfied-by
Provides the TypeScript compiler API for parsing and analyzing TypeScript code.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-ts-api-utilsevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10