getdocs2ts
Version:
This is a utility that transforms code documented with getdocs-style doc comments into TypeScript definition files
31 lines (30 loc) • 1.06 kB
TypeScript
import StringBuilder = require('string-builder');
export declare type Imports = {
[moduleName: string]: string[];
};
export declare type TypeInfo = {
replaceBy?: string;
definedIn?: string;
code?: string;
};
export declare type TypeInfos = {
[typeName: string]: TypeInfo;
};
export declare const baseTypes: TypeInfos;
export declare function mergeTypeInfos(a: TypeInfos, b: TypeInfos): TypeInfos;
export declare class GenEnv {
readonly imports: Imports;
private currModuleName;
private typeInfos;
readonly sb: StringBuilder;
private indentation;
private firstInLine;
private static warnedAbout;
constructor(currModuleName: string, imports: Imports, typeInfos: TypeInfos, sb: StringBuilder, indentation?: string, firstInLine?: boolean);
indent(): GenEnv;
customCodeFor(rawName: string): string | undefined;
resolveTypeName(rawName: string): string;
append(str: string): void;
appendLine(str: string): void;
}
export declare function emptyEnvForTests(additionalTypes?: TypeInfos): GenEnv;