UNPKG

proto-gen-dts

Version:
67 lines (66 loc) 1.77 kB
import { prettier } from 'stan-utils'; import type { Field, ReflectionObject } from 'protobufjs'; import { NamespaceBase, Namespace } from 'protobufjs'; /** * check is protobufjs Namespace * @param nested */ export declare function isNamespace(nested: ReflectionObject): boolean; /** * get namespace root * @param nested */ export declare function getNamespaceRoot(nested: NamespaceBase): NamespaceBase; /** * prettier format ts content * @param content * @param opts * @returns parsed content */ export declare function formatTS(content: string, opts?: prettier.Options): string; declare const Types: { number: string[]; string: string[]; boolean: string[]; }; /** * process proto type convert ts type * @param input proto type * @returns ts type */ export declare function protoTypeToTSType(input: string): keyof typeof Types | void; export declare function getFieldIsRequired(field: Field): boolean; /** * use parent lookup * @param field * @param root * @param type */ export declare function getParentLookup({ field, root, type, }: { field: Field; root: Namespace; type: string; }): ReflectionObject | null; export declare function getReflectionParentName(field: ReflectionObject): string; /** * replace same real path * @param base * @param file */ export declare function replaceSamePath(base: string, file: string): string; /** * document banner * @param content file text content */ export declare function writeBanner(content: string): string; /** * output issues uri * @param opt */ export declare function reportIssues(opt: { labels?: string; title?: string; template?: string; }): string; export declare function optionsToComment(options: ReflectionObject['options']): string; export {};