UNPKG

@coat/cli

Version:

TODO: See #3

27 lines (26 loc) 1.34 kB
import { CoatManifestFileContentTypesMap, CoatManifestMergedFile, CoatManifestGroupedFile } from "../types/coat-manifest-file"; import { CoatContext } from "../types/coat-context"; export interface FileTypeFunctions<ContentType> { /** * Merges the source and the target content */ merge: (source: ContentType | null | undefined, target: ContentType) => ContentType | null; /** * Converts the content of the file * to a string and styles the result, * usually using prettier */ polish: (source: ContentType, filePath: string, context: CoatContext) => string; } /** * Retrieves the merge function for the specified file type. * This function is currently necessary to correctly cast the * type of the merge function to the correct file type. */ export declare function getMergeFunction<FileType extends CoatManifestGroupedFile>(file: FileType): FileTypeFunctions<CoatManifestFileContentTypesMap[FileType["type"]]>["merge"]; /** * Retrieves the polish function for the specified file type. * This function is currently necessary to correctly cast the * type of the polish function to the correct file type. */ export declare function getPolishFunction<FileType extends CoatManifestMergedFile>(file: FileType): FileTypeFunctions<CoatManifestFileContentTypesMap[FileType["type"]]>["polish"];