CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-ts-api-utils

tessl install tessl/npm-ts-api-utils@2.0.0

Utility functions for working with TypeScript's API, providing comprehensive tools for analyzing and manipulating TypeScript AST nodes, types, and compiler APIs.

Agent Success

Agent success rate when using this tile

79%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.98x

Baseline

Agent success rate without this tile

40%

task.mdevals/scenario-7/

TypeScript AST Node Classifier

A tool that analyzes TypeScript source code and classifies different types of nodes found in the Abstract Syntax Tree (AST).

Capabilities

Classify type keyword nodes

  • Given a TypeScript source file containing any, boolean, number, and string type keywords, the classifier identifies and counts each type keyword category @test
  • Given a TypeScript source file with no type keywords, the classifier returns zero counts for all type keyword categories @test

Classify boolean literal nodes

  • Given a TypeScript source file containing true and false literals, the classifier identifies and counts true literals and false literals separately @test

Classify modifier keywords

  • Given a TypeScript class with public, private, protected, static, readonly, and abstract modifiers, the classifier identifies and counts each modifier type @test

Implementation

@generates

API

/**
 * 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;

Dependencies { .dependencies }

ts-api-utils { .dependency }

Provides type guard functions for TypeScript AST nodes.

@satisfied-by

typescript { .dependency }

Provides the TypeScript compiler API for parsing and analyzing TypeScript code.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/ts-api-utils@2.0.x
tile.json