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-3/

Token Counter

Build a utility that counts and categorizes tokens in TypeScript source code.

Capabilities

Token Counting

  • Counts the total number of tokens in a valid TypeScript source string @test
  • Returns zero for an empty source file @test

Identifier Extraction

  • Extracts all identifier tokens from TypeScript source code @test
  • Returns an empty array when no identifiers are present in the source @test

Implementation

@generates

API

/**
 * Counts the total number of tokens in TypeScript source code
 * @param sourceCode - TypeScript source code as a string
 * @returns The total count of tokens
 */
export function countTokens(sourceCode: string): number;

/**
 * Extracts all identifier token texts from TypeScript source code
 * @param sourceCode - TypeScript source code as a string
 * @returns Array of identifier strings found in the source
 */
export function extractIdentifiers(sourceCode: string): string[];

Dependencies { .dependencies }

ts-api-utils { .dependency }

Provides TypeScript AST token traversal utilities for iterating over tokens in source code.

@satisfied-by

typescript { .dependency }

TypeScript compiler API for parsing source code and working with AST nodes.

@satisfied-by

Version

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