Utility functions for working with TypeScript's API, providing comprehensive tools for analyzing and manipulating TypeScript AST nodes, types, and compiler APIs.
79
Build a utility that analyzes TypeScript code properties and validates property access patterns. The tool should identify assignments, validate property names, and suggest appropriate property access syntax.
Detects assignment operations in TypeScript code.
= operator, identifies it as an assignment @test+= operator, identifies it as an assignment @test===, identifies it as not an assignment @testAnalyzes and categorizes property names in object literals.
Validates property names for dot notation access and recommends appropriate access syntax.
@generates
import * as ts from "typescript";
/**
* Analyzes a binary expression to determine if it represents an assignment operation.
*
* @param expression - The binary expression to analyze
* @returns true if the expression is an assignment, false otherwise
*/
export function isAssignment(expression: ts.BinaryExpression): boolean;
/**
* Determines if a property name is numeric.
*
* @param propertyName - The property name to analyze
* @returns true if the property name is numeric, false otherwise
*/
export function isNumericProperty(propertyName: string): boolean;
/**
* Recommends the appropriate property access syntax for a given property name.
*
* @param propertyName - The property name to validate
* @returns "dot" if dot notation can be used, "bracket" if bracket notation must be used
*/
export function recommendAccessSyntax(propertyName: string): "dot" | "bracket";Provides TypeScript AST analysis utilities.
@satisfied-by
TypeScript compiler API for AST node types.
@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