Utility functions for working with TypeScript's API, providing comprehensive tools for analyzing and manipulating TypeScript AST nodes, types, and compiler APIs.
79
A TypeScript tool that analyzes comments in TypeScript source code files and provides statistics and content extraction capabilities.
singleLine and multiLine counts @test@generates
/**
* Extracts all comments from a TypeScript source file.
*
* @param sourceCode - The TypeScript source code as a string
* @returns An array of comment text content (without comment delimiters)
*/
export function extractComments(sourceCode: string): string[];
/**
* Counts comments by type in a TypeScript source file.
*
* @param sourceCode - The TypeScript source code as a string
* @returns An object with singleLine and multiLine counts
*/
export function countCommentsByType(sourceCode: string): {
singleLine: number;
multiLine: number;
};
/**
* Generates statistics about comments in a TypeScript source file.
*
* @param sourceCode - The TypeScript source code as a string
* @returns An object with total count, total characters, and average length
*/
export function getCommentStatistics(sourceCode: string): {
totalComments: number;
totalCharacters: number;
averageLength: number;
};Provides utilities for working with TypeScript's Compiler API, including comment extraction capabilities.
Provides the TypeScript compiler API for parsing and analyzing TypeScript code.
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