ts-gir
Version:
generate typescript from gir
39 lines (38 loc) • 2.38 kB
TypeScript
import BabelParserGenerator, { InjectPath } from 'babel-parser-generator';
import { ParserOptions } from '@babel/parser';
import { Alias, Callback, Class, ClassIdentifiers, Constant, Constructor, Enumeration, Function, GirType, Interface, Logger, Member, Method, Namespace, Parameter, Property, Renamed, Union, UserConfig } from './types';
export default class GirTSGenerator extends BabelParserGenerator {
$namespace: Namespace;
userConfig: UserConfig;
logger: Logger;
moduleName: string;
options: ParserOptions;
imports: Set<string>;
isModule: boolean;
moduleTypes: Set<string>;
renamed: Renamed;
constructor($namespace: Namespace, userConfig: UserConfig, logger: Logger, moduleName?: string);
build(): void;
setModulesTypes(): void;
buildModules(path?: InjectPath): void;
buildImports(imports: Set<string>, path?: InjectPath): void;
buildTypeDeclarations($aliasesOrUnions: Alias[] | Union[], path?: InjectPath): void;
buildEnumDeclarations($enumerations: Enumeration[], path?: InjectPath): void;
buildEnumDeclarationMembers($members: Member[], path?: InjectPath): void;
buildConstantDeclarations($constants: Constant[], path?: InjectPath): void;
buildFunctionDeclarations($functions: Function[], path?: InjectPath): void;
buildCallbackDeclarations($callbacks: Callback[], path?: InjectPath): void;
buildFunctionParams($parameters: Parameter[], path?: InjectPath): void;
buildInterfaceDeclarations($interfaces: Interface[], path?: InjectPath): void;
buildClassDeclarations($classes: Class[], path?: InjectPath): void;
getClassIdentifiers($class?: Class | Interface, recursive?: boolean): ClassIdentifiers;
getParentClassIdentifiers($class?: Class | Interface, recursive?: boolean): ClassIdentifiers;
buildMethodDeclarations($methods: Method[] | Function[], path?: InjectPath, $class?: Class | Interface, isStatic?: boolean): void;
buildConstructorDeclaration($constructors: Constructor[], path?: InjectPath): void;
buildMethodDeclarationParams($parameters: Parameter[], path?: InjectPath): void;
buildPropertyDeclarations($properties: Property[], path?: InjectPath, $class?: Class | Interface, isStatic?: boolean): void;
getType(girType: GirType, options?: {
isArray?: boolean | null;
nullable?: boolean | null;
}): string | null;
}