UNPKG

3.23 kBTypeScriptView Raw
1import * as ts from 'typescript';
2import { Decorator, ModifiersArray, Node, NodeArray, ObjectFlags, SyntaxKind, Type, TypeChecker, TypeFlags, TypeFormatFlags, UnionTypeNode } from 'typescript';
3export declare function getDecorators(node: ts.Node): readonly ts.Decorator[];
4export declare function getModifiers(node: ts.Node): readonly ts.Modifier[];
5export declare function isArray(type: Type): boolean;
6export declare function getTypeArguments(type: Type): any;
7export declare function isBoolean(type: Type): boolean;
8export declare function isString(type: Type): boolean;
9export declare function isStringLiteral(type: Type): boolean;
10export declare function isBigInt(type: Type): boolean;
11export declare function isNumber(type: Type): boolean;
12export declare function isInterface(type: Type): boolean;
13export declare function isEnum(type: Type): boolean;
14export declare function isEnumLiteral(type: Type): boolean;
15export declare function isNull(type: Type): boolean;
16export declare function isUndefined(type: Type): boolean;
17export declare function hasFlag(type: Type, flag: TypeFlags): boolean;
18export declare function hasObjectFlag(type: Type, flag: ObjectFlags): boolean;
19export declare function getText(type: Type, typeChecker: TypeChecker, enclosingNode?: Node, typeFormatFlags?: TypeFormatFlags): string;
20export declare function getDefaultTypeFormatFlags(enclosingNode: Node): number;
21export declare function getDecoratorArguments(decorator: Decorator): any[] | ts.NodeArray<ts.Expression>;
22export declare function getDecoratorName(decorator: Decorator): string;
23export declare function getJSDocDescription(node: Node): string;
24export declare function hasJSDocTags(node: Node, tagName: string[]): boolean;
25export declare function getJsDocDeprecation(node: Node): string;
26export declare function findNullableTypeFromUnion(typeNode: UnionTypeNode, typeChecker: TypeChecker): ts.TypeNode;
27export declare function hasModifiers(modifiers: ModifiersArray | readonly ts.Modifier[], toCheck: SyntaxKind[]): boolean;
28export declare function hasDecorators(decorators: NodeArray<Decorator> | readonly Decorator[], toCheck: string[]): boolean;
29export declare function hasImport(sf: ts.SourceFile, what: string): boolean;
30export declare function createImportEquals(f: ts.NodeFactory, identifier: ts.Identifier | string, from: string): ts.ImportEqualsDeclaration;
31export declare function createNamedImport(f: ts.NodeFactory, what: string[], from: string): ts.ImportDeclaration;
32export declare function isCallExpressionOf(name: string, node: ts.CallExpression): boolean;
33export type PrimitiveObject = {
34 [key: string]: string | boolean | ts.Node | PrimitiveObject;
35};
36export declare function serializePrimitiveObjectToAst(f: ts.NodeFactory, object: PrimitiveObject): ts.ObjectLiteralExpression;
37export declare function safelyMergeObjects(f: ts.NodeFactory, a: ts.Expression, b: ts.Expression): ts.ObjectLiteralExpression;
38export declare function updateDecoratorArguments<T extends ts.ClassDeclaration | ts.PropertyDeclaration | ts.GetAccessorDeclaration>(f: ts.NodeFactory, node: T, decoratorName: string, replaceFn: (decoratorArguments: ts.NodeArray<ts.Expression>) => ts.Expression[]): T;
39//# sourceMappingURL=ast-utils.d.ts.map
\No newline at end of file