sicua
Version:
A tool for analyzing project structure and dependencies
54 lines (53 loc) • 1.69 kB
TypeScript
import ts from "typescript";
export declare class TypeEvaluator {
private typeChecker;
constructor(typeChecker: ts.TypeChecker);
/**
* Gets the type string for a node
*/
evaluateType(node: ts.Node): string;
/**
* Extracts type properties from an interface or type
*/
extractTypeProperties(type: ts.TypeNode): Record<string, string>;
/**
* Evaluates union type components
*/
evaluateUnionType(type: ts.UnionTypeNode): string[];
/**
* Gets return type of a function-like declaration
*/
getFunctionReturnType(node: ts.FunctionLikeDeclaration): string | undefined;
/**
* Gets parameter types of a function-like declaration
*/
getFunctionParameterTypes(node: ts.FunctionLikeDeclaration): Record<string, string>;
/**
* Gets the base type(s) of a class/interface
*/
getBaseTypes(node: ts.ClassDeclaration | ts.InterfaceDeclaration): string[];
/**
* Checks if a type is assignable to another type
*/
isTypeAssignableTo(source: ts.Node, target: ts.Node): boolean;
/**
* Gets resolved type arguments for a generic type
*/
getTypeArguments(node: ts.TypeReferenceNode): string[];
/**
* Helper method to convert TypeNode to string
*/
private getTypeString;
/**
* Gets inferred type of a node
*/
getInferredType(node: ts.Node): string;
/**
* Checks if a type is a Promise type
*/
isPromiseType(node: ts.Node): boolean;
/**
* Gets the declared type of a variable/parameter
*/
getDeclaredType(declaration: ts.VariableDeclaration | ts.ParameterDeclaration): string | undefined;
}