At my TypeScript playground, I've encountered some issues with a large entrypoint. Although a simplified version seems to work, the actual function 'convert' is causing problems. The main issue arises when calling nested functions like 'convertFontWithFontForgeNode' and 'convertImageWithImageMagickNode'. There are type errors being displayed that suggest an incompatibility between ImageMagick and FontForge types.
export async function convert<I extends ConvertInputFormat>(
source: Convert<I>,
) {
// code block here
}
The error messages indicate a mismatch in format types between ImageMagick and FontForge. By reducing the number of enum values for the 'format', the issue seems to be resolved. This could be due to overlapping values between FontFormat and ImageMagick types causing conflicts.
The goal is to have different formats supported within the 'convert' function, with each format having its own properties and configurations. However, attempts to handle these variations using 'ConvertOutputFormat[I]['extend']' seem to be failing.
Additional complexity arises from the need to pass types down to nested functions like 'convertFontWithFontForgeNode' using Zod schemas. These schemas directly correspond to TypeScript types but may not be fully compatible with the overarching 'convert' function.
Overall, the objective is to ensure seamless conversion functionality for various input-output pairs while maintaining clear distinctions between formats and associated properties.