Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3796771
Add isAutoAccessorPropertyDeclaration AST predicate
andrewbranch Nov 19, 2026
f5704d7
Add isCallChain AST predicate
andrewbranch Nov 19, 2026
6c5be79
Add isClassElement AST predicate
andrewbranch Nov 19, 2026
89ff33b
Add isConstTypeReference AST predicate
andrewbranch Nov 19, 2026
ac330e0
Add isDeclarationStatement AST predicate
andrewbranch Nov 19, 2026
c8d9b6c
Add isElementAccessChain AST predicate
andrewbranch Nov 19, 2026
8655e20
Add isEmptyBindingElement AST predicate
andrewbranch Nov 19, 2026
ce675dc
Add isEmptyBindingPattern AST predicate
andrewbranch Nov 19, 2026
f9143dd
Add isFunctionLike AST predicate
andrewbranch Nov 19, 2026
d86f236
Add isFunctionOrConstructorTypeNode AST predicate
andrewbranch Nov 19, 2026
e870e8b
Add isImportOrExportSpecifier AST predicate
andrewbranch Nov 19, 2026
c7d82ed
Add isIterationStatement AST predicate
andrewbranch Nov 19, 2026
6aa16f4
Add isJsxCallLike AST predicate
andrewbranch Nov 19, 2026
78dfa74
Add isNonNullChain AST predicate
andrewbranch Nov 19, 2026
e79c67e
Add isNullishCoalesce AST predicate
andrewbranch Nov 19, 2026
8836315
Add isObjectLiteralElement AST predicate
andrewbranch Nov 19, 2026
8ed3266
Add isOptionalChain AST predicate
andrewbranch Nov 19, 2026
d43b997
Add isParameterPropertyDeclaration AST predicate
andrewbranch Nov 19, 2026
23267ad
Add isPropertyAccessChain AST predicate
andrewbranch Nov 19, 2026
5e6d0c5
Add isPropertyAccessOrQualifiedName AST predicate
andrewbranch Nov 19, 2026
204b190
Add isRestParameter AST predicate
andrewbranch Nov 19, 2026
5e8adc8
Add isStringLiteralOrJsxExpression AST predicate
andrewbranch Nov 19, 2026
0d7e87b
Add isStringTextContainingNode AST predicate
andrewbranch Nov 19, 2026
c748285
Add isTypeElement AST predicate
andrewbranch Nov 19, 2026
7e0c599
Add isClassOrTypeElement AST predicate
andrewbranch Nov 19, 2026
a1e498c
Add isTypeOnlyImportDeclaration AST predicate
andrewbranch Nov 19, 2026
6ece3a3
Add isTypeOnlyExportDeclaration AST predicate
andrewbranch Nov 19, 2026
0f57f86
Add isTypeOnlyImportOrExportDeclaration AST predicate
andrewbranch Nov 19, 2026
b3aa44b
Add isPartOfTypeOnlyImportOrExportDeclaration AST predicate
andrewbranch Nov 19, 2026
02c3691
Add isPartOfTypeNode AST predicate
andrewbranch Nov 19, 2026
9b50a6a
Add isExternalModuleNameRelative AST predicate
andrewbranch Nov 19, 2026
a3ebec9
Use named imports in AST predicates
andrewbranch Nov 19, 2026
70ad2e4
Update packages/typescript/src/ast/is.ts
andrewbranch Nov 20, 2026
1600639
Update packages/typescript/src/ast/is.ts
andrewbranch Nov 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions packages/typescript/src/ast/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,39 @@ import { SyntaxKind } from "../../enums/syntaxKind.js";
import type {
AssertionExpression,
BindingElement,
BindingPattern,
CallExpression,
CaseClause,
ComputedPropertyName,
Decorator,
DoStatement,
ElementAccessExpression,
EndOfFile,
EntityName,
EnumMember,
ExportDeclaration,
ExportSpecifier,
Expression,
ExpressionStatement,
ForInStatement,
ForOfStatement,
ForStatement,
Identifier,
IfStatement,
ImportClause,
ImportEqualsDeclaration,
ImportSpecifier,
JSDoc,
JsxAttribute,
JsxExpression,
JsxSpreadAttribute,
KeywordSyntaxKind,
ModifierSyntaxKind,
NamedExports,
NamedImports,
NamespaceExport,
NamespaceImport,
NonNullExpression,
ParameterDeclaration,
PropertyAccessExpression,
PropertyAssignment,
Expand Down Expand Up @@ -58,6 +71,59 @@ export { TokenFlags } from "../../enums/tokenFlags.js";
export * from "./ast.generated.ts";
export * as factory from "./factory.generated.ts";

declare const autoAccessorBrand: unique symbol;
export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration {
readonly [autoAccessorBrand]: void;
}

declare const optionalChainBrand: unique symbol;
export interface CallChain extends CallExpression {
readonly [optionalChainBrand]: void;
}

export interface ElementAccessChain extends ElementAccessExpression {
readonly [optionalChainBrand]: void;
}

declare const emptyBindingPatternBrand: unique symbol;
export type EmptyBindingPattern = BindingPattern & { readonly [emptyBindingPatternBrand]: void; };

export interface NonNullChain extends NonNullExpression {
readonly [optionalChainBrand]: void;
}

export interface PropertyAccessChain extends PropertyAccessExpression {
readonly [optionalChainBrand]: void;
}

export type OptionalChain = PropertyAccessChain | ElementAccessChain | CallChain | NonNullChain;

declare const parameterPropertyBrand: unique symbol;
export interface ParameterPropertyDeclaration extends ParameterDeclaration {
readonly [parameterPropertyBrand]: void;
}

export type TypeOnlyImportDeclaration =
| ImportClause & { readonly phaseModifier: SyntaxKind.TypeKeyword; }
| ImportEqualsDeclaration & { readonly isTypeOnly: true; }
| NamespaceImport & { readonly parent: ImportClause & { readonly phaseModifier: SyntaxKind.TypeKeyword; }; }
| ImportSpecifier
& (
| { readonly isTypeOnly: true; }
| { readonly parent: NamedImports & { readonly parent: ImportClause & { readonly phaseModifier: SyntaxKind.TypeKeyword; }; }; }
);

export type TypeOnlyExportDeclaration =
| ExportSpecifier
& (
| { readonly isTypeOnly: true; }
| { readonly parent: NamedExports & { readonly parent: ExportDeclaration & { readonly isTypeOnly: true; }; }; }
)
| ExportDeclaration & { readonly isTypeOnly: true; readonly moduleSpecifier: Expression; readonly exportClause?: undefined; }
| NamespaceExport & { readonly parent: ExportDeclaration & { readonly isTypeOnly: true; }; };

export type TypeOnlyAliasDeclaration = TypeOnlyImportDeclaration | TypeOnlyExportDeclaration;

// ── Core types ──

declare const rootedPathBrand: unique symbol;
Expand Down
Loading
Loading