Using Yellicode in a TypeScript project

You might want to use Yellicode templates, written in TypeScript, to generate TypeScript code. This could cause your code generation code and other TypeScript code - with different compilation requirements - to get in each other's way. If you compile all your project's TypeScript code using a configuration that is incompatible with Node.js (Yellicode runs on Node.js), your code generation process could throw errors or yield unexpected results.

Excluding templates from default compilation

In order to avoid code generation errors, your templates should be excluded from the default TypeScript compilation. Therefore, it is recommended to follow a naming convention for all your templates, for example by ending each template name with .template.ts. Then, in your project's default tsconfig.json, ensure that the exclude section contains the following:

{
    "compilerOptions": {
        // left out for brevity
    },
    "exclude": [
        "**/*.template.ts"
    ]
}

This will make sure that code generation templates are not compiled by default and will only be compiled by Yellicode instead. If you need more control over how templates are compiled, please refer to Configuring TypeScript.