Is there a method to achieve the following?:
my-custom-template.mstach
Hello {{name}}!
script.js
import { readFileSync, writeFileSync } from 'fs';
import * as Mustache from 'mustache';
export interface Person {
name: string;
}
const data: Person = {
name: 'Jon'
};
const templateContent = readFileSync('my-custom-template.mustache', 'utf-8');
// finding a way to specify the type of data in IDE
const result = Mustache.render(templateContent, data);
writeFileSync('my-custom-template.html', result, 'utf-8');
In case you were to modify it like this:
my-custom-template.mstach
Hello {{name}}, {{age}} <!-- red squiggles under age -->
This would result in having age
not being part of the type Person, causing red squiggles. Seeking a solution that is compatible with Visual Studio Code.
Update:
Just to clarify, I am aiming for the outcome:
Hello {{name}}, {{age}} <!-- red squiggles under age -->
, rather than facing an issue with it.