Documentation menu

Typescript

Browse Typescript documentation.

JSXElementAbstract representation of TSX/JSX elements, e.g. `<MyComponent />`. This allows for many React-specific modifications, like adding props, changing the name, etc.JSXExpressionAbstract representation of TSX/JSX expressionJSXPropAbstract representation of TSX/JSX prop, e.g `<Component prop="value" />`.TSArrayTypeArray type Examples: string[]TSAssignmentA class representing TypeScript assignments, including variable declarations and property assignments. Handles various types of TypeScript assignments including variable declarators, assignment expressions, augmented assignments, property signatures, and public field definitions. It provides functionality for manipulating assignments and managing their associated types and comments.TSAssignmentStatementA class that represents a TypeScript assignment statement in a codebase, such as `const x = 1` or `const { a: b } = myFunc()`.TSAttributeTypescript implementation of Attribute detached symbol.TSBlockStatementStatement which contains a block.TSCatchStatementTypescript catch clause.TSChainedAttributeA TypeScript chained attribute class representing member access expressions. This class handles the representation and analysis of chained attribute access expressions in TypeScript, such as 'object.property' or 'object.method()'. It provides functionality for accessing the object and property components of the expression, as well as analyzing function calls made on the object.TSClassA class representing a TypeScript/JavaScript class with enhanced functionality for class manipulation. The TSClass provides comprehensive functionality for working with TypeScript/JavaScript classes, including handling class methods, attributes, JSX components, and inheritance relationships. It supports operations like adding source code to class bodies, managing class attributes, and handling React JSX components.TSCodeBlockExtends the CodeBlock class to provide TypeScript-specific functionality.TSCommentAbstract representation of typescript commentsTSCommentGroupA group of related symbols that represent a comment or docstring in TypeScript For example: ``` // Comment 1 // Comment 2 // Comment 3 ``` would be 3 individual comments (accessible via `symbols`), but together they form a `CommentGroup` (accessible via `self).TSCommentTypeAn enumeration representing different types of comments in TypeScript. Represents the possible types of comments that can be used in TypeScript code, including double slash comments (//), slash star comments (/* */), and unknown comment types.TSConditionalTypeConditional Type Examples: typeof sTSConfigTypeScript configuration file specified in tsconfig.json, used for import resolution and computing dependencies.TSDecoratorAbstract representation of a DecoratorTSDictA typescript dict object. You can use standard operations to operate on this dict (IE len, del, set, get, etc)TSEnumRepresentation of an Enum in TypeScript.TSExportRepresents a single exported symbol. There is a 1:M relationship between an ExportStatement and an ExportTSExpressionTypeType defined by evaluation of an expressionTSFileExtends the SourceFile class to provide TypeScript-specific functionality.TSForLoopStatementAbstract representation of the for loop in TypeScript.TSFunctionRepresentation of a Function in JavaScript/TypeScriptTSFunctionTypeFunction type definition. Example: a: (a: number) => numberTSGenericTypeGeneric type Examples: `Array<Type>`TSHasBlockA TypeScript base class that provides block-level code organization and decorator handling capabilities. This class extends the concept of block scoping for TypeScript code elements like classes and functions. It provides functionality for managing code blocks, decorators, JSX elements, and documentation within those blocks. The class supports operations such as retrieving and manipulating docstrings, handling JSX components, and managing TypeScript decorators.TSIfBlockStatementTypescript implementation of the if/elif/else statement block. For example, if there is a code block like: if (condition1) { block1 } else if (condition2) { block2 } else { block3 } This class represents the entire block, including the conditions and nested code blocks.TSImportExtends Import for TypeScript codebases.TSImportStatementA class representing an import statement in TypeScript, managing both static and dynamic imports. This class handles various types of TypeScript imports including regular import statements, dynamic imports, and export statements. It provides functionality to manage and track imports within a TypeScript file, enabling operations like analyzing dependencies, moving imports, and modifying import statements.TSInterfaceRepresentation of an Interface in TypeScriptTSLabeledStatementStatement with a named label. It resolves to various types of statements like loops, switch cases, etc. Examples: ``` outerLoop: for (let i = 0; i < 5; i++) { innerLoop: for (let j = 0; j < 5; j++) { if (i === 2 && j === 2) { break outerLoop; // This will break out of the outer loop } console.log(`i: ${i}, j: ${j}`); } } ``` ``` emptyStatement: { pass } ```TSLookupTypeType lookup Examples: a["key"]TSNamedTypeNamed type Examples: stringTSNamespaceRepresentation of a namespace module in TypeScript.TSObjectTypeA class representing a TypeScript object type with type annotations and dependencies. A specialized class extending `TSDict` and implementing `Type` for handling TypeScript object type annotations. This class handles object type definitions including nested type structures and manages their dependencies. It provides functionality for computing dependencies within the type structure and handling type relationships in TypeScript code.TSPairA TypeScript pair node that represents key-value pairs in object literals. A specialized class extending `Pair` for handling TypeScript key-value pairs, particularly in object literals. It provides functionality for handling both regular key-value pairs and shorthand property identifiers, with support for reducing boolean conditions.TSParameterA class representing a TypeScript function parameter with extensive type analysis capabilities. This class provides functionality to inspect and manipulate TypeScript function parameters, including support for destructured parameters, optional parameters, variadic parameters, default values, and type annotations.TSQueryTypeType query Examples: typeof sTSReadonlyTypeReadonly type Examples: readonly sTSReturnTypePlaceholderA placeholder class for function return type annotations in TypeScript. This class represents a placeholder for function return type annotations, allowing for modification and addition of return type annotations after the parameter list. It provides functionality to add or modify return type annotations with proper formatting.TSStringA TypeScript string node representing both literal strings and template strings. This class handles both regular string literals and template strings in TypeScript, providing functionality to parse and manage template string expressions. It extends the base String class with TypeScript-specific capabilities.TSSwitchCaseTypescript switch case.TSSwitchStatementTypescript switch statementTSSymbolA TypeScript symbol representing a code element with advanced manipulation capabilities. This class extends Symbol and Exportable to provide TypeScript-specific functionality for managing code symbols. It offers methods for handling imports, comments, code refactoring, and file operations like moving symbols between files while maintaining their dependencies and references. The class provides functionality for managing both inline and block comments, setting and retrieving import strings, and maintaining semicolon presence. It includes capabilities for moving symbols between files with options to handle dependencies and import strategy selection.TSTernaryExpressionAny ternary expression in the code where a condition will determine branched executionTSTryCatchStatementAbstract representation of the try/catch/finally block in TypeScript.TSTypeAliasRepresentation of an Interface in TypeScript.TSUndefinedTypeUndefined type. Represents the undefined keyword Examples: undefinedTSUnionTypeUnion type Examples: string | numberTSWhileStatementA TypeScript while statement class that represents while loops and manages their condition and code block. This class provides functionality for handling while statements in TypeScript code, including managing the loop's condition and associated code block. It extends the base WhileStatement class with TypeScript-specific behavior.