UNPKG

strapi-plugin-gen-types

Version:

Generate types for the different collections, single types & components found in your application

34 lines (33 loc) 1.16 kB
import type { Core } from "@strapi/strapi"; import { StrapiAttribute, StrapiSchema } from "../genTypes/types"; declare const service: ({ strapi }: { strapi: Core.Strapi; }) => { /** * Walk a directory and return an array of file paths * @param dir - The directory to walk * @returns An array of file paths */ walkDirectory: (dir: string) => string[]; /** * Get the model name from the target string * * @param target The target string (e.g., 'api::patient.patient') * @returns The model name (e.g., 'Patient') */ getModelNameFromTarget: (target: string) => string; /** * Generate a TypeScript type for a Strapi attribute */ generateTypeForAttribute: (attribute: StrapiAttribute) => string; generateInterfaceFromSchema: (modelName: string, schema: StrapiSchema, isComponent?: boolean) => { interfaceString: string; imports: string[]; }; generateInterfaceStrings: () => any; /** * Generate TypeScript interfaces from Strapi schema files */ generateInterfaces: (outPath: string, singleFile: boolean) => void; }; export default service;