ts-budgie
Version:
Converts TypeScript code to Budgie.
49 lines (48 loc) • 1.68 kB
TypeScript
import * as ts from "typescript";
import { BudgieLine } from "../../output/budgieLine";
export interface ITypeAdjustmentAttemptInfo {
/**
* Friendly type of the node's value, if immediately available.
*/
actualValue?: string | BudgieLine;
/**
* Variable declaration node.
*/
node: ts.VariableDeclaration;
/**
* Original friendly type name of the node.
*/
originalType: string | BudgieLine | undefined;
}
/**
* Tries to find more specific types for variable declarations.
*/
export interface ITypeAdjustmentChecker {
/**
* Tries to find a more specific type for a variable declaration.
*
* @param info Info on the variable declaration.
* @returns More specific type for the variable declaration, if available.
*/
attempt(info: ITypeAdjustmentAttemptInfo): string | BudgieLine | undefined;
}
/**
* Tries to find more specific types for variable declarations.
*/
export declare class TypeAdjuster implements ITypeAdjustmentChecker {
private readonly checkers;
/**
* Tries to find a more specific type for a variable declaration.
*
* @param info Info on the variable declaration.
* @returns More specific type for the variable declaration, if available.
*/
attempt(info: ITypeAdjustmentAttemptInfo): BudgieLine | string | undefined;
/**
* Tries to find a more specific type based on a known Budgie command.
*
* @param line Budgie command line.
* @returns Known type of that command line, if available.
*/
getKnownTypeOfBudgieLine(line: BudgieLine): string | undefined;
}