How to use the recast/lib/types.builders function in recast

To help you get started, we’ve selected a few recast examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DimaLiLongJi / InDiv / packages / indiv-loader / compiler / class-property-compiler.ts View on Github external
export function classPropertyCompiler(templateInfo: { templateString: string; classBody: any }, useTypeScript: boolean): void {
  const typeAnnotation = useTypeScript ? types.builders.typeAnnotation(
    types.builders.genericTypeAnnotation(types.builders.identifier('string'), null),
  ) : null;
  templateInfo.classBody.body.body.push(types.builders.classProperty(
    types.builders.identifier('$template'),
    types.builders.identifier(`\`${templateInfo.templateString}\``),
    typeAnnotation,
  ));
}
github DimaLiLongJi / InDiv / packages / indiv-loader / compiler / class-property-compiler.ts View on Github external
export function classPropertyCompiler(templateInfo: { templateString: string; classBody: any }, useTypeScript: boolean): void {
  const typeAnnotation = useTypeScript ? types.builders.typeAnnotation(
    types.builders.genericTypeAnnotation(types.builders.identifier('string'), null),
  ) : null;
  templateInfo.classBody.body.body.push(types.builders.classProperty(
    types.builders.identifier('$template'),
    types.builders.identifier(`\`${templateInfo.templateString}\``),
    typeAnnotation,
  ));
}