in src/generate.ts [42:69]
export function generateAssignmentStatement(type: reflect.ClassType | reflect.InterfaceType): Code | undefined {
const context = new ExampleContext(type.system);
if (type.isClassType()) {
const expression = exampleValueForClass(context, type, 0);
if (!expression) { return undefined; }
return Code.concatAll(
`const ${escapeIdentifier(lowercaseFirstLetter(type.name))} = `,
expression,
';',
);
}
if (type.isInterfaceType()) {
const expression = exampleValueForStruct(context, type, 0);
if (!expression) { return undefined; }
return Code.concatAll(
`const ${escapeIdentifier(lowercaseFirstLetter(type.name))}: `,
typeReference(type),
' = ',
expression,
';',
);
}
return undefined;
}