UNPKG

typescript-scaffolder

Version:

![npm version](https://img.shields.io/npm/v/typescript-scaffolder) ### Unit Test Coverage: 97.12%

36 lines 1.45 kB
/** * Extracts interface names and keys from a TypeScript file using ts-morph. */ export declare function extractInterfaceKeysFromFile(filePath: string): { name: string; keys: string[]; }[]; /** * If ts-morph returns a string-literal property name (e.g. "\"Card Number\""), * remove the surrounding quotes so downstream quotation is applied exactly once. */ export declare function stripSurroundingQuotes(str: string): string; /** * Generates TypeScript enum string from interface key names. */ export declare function generateEnum(name: string, keys: string[]): string; /** * Tests to make sure the identifier is a valid string using regex * @param str */ export declare function isValidIdentifier(str: string): boolean; /** * Processes a single file and writes enums for interfaces. Keeping async for now * To resolve race condition issues on the thread */ export declare function generateEnums(filePath: string, relativePath: string, outputBaseDir: string): Promise<void>; /** * Parses a file structure housing interfaces and regenerates the directory tree with enums. * Only does TypeScript Interfaces for now. This needs to be async for proper chaining as the previous * Executions should save first * @param schemaDir * @param outputDir * @param ext */ export declare function generateEnumsFromPath(schemaDir: string, outputDir: string, ext?: string): Promise<void>; //# sourceMappingURL=generate-enums.d.ts.map