@rxap/schematics-ts-morph
Version:
This package provides utilities for manipulating TypeScript code using ts-morph, particularly for Angular and NestJS projects. It offers functions to add, coerce, and modify code elements like classes, methods, decorators, and imports. The package also in
15 lines (14 loc) • 1 kB
TypeScript
import { ConstructorDeclarationStructure, DecoratorStructure, ImportDeclarationStructure, OptionalKind, SourceFile, StatementStructures, TypeParameteredNodeStructure, WriterFunction } from 'ts-morph';
export interface AddMethodClassOptions extends TypeParameteredNodeStructure {
structures?: ReadonlyArray<OptionalKind<ImportDeclarationStructure>>;
returnType?: string;
parameterType?: string;
isAsync?: boolean;
statements?: (string | WriterFunction | StatementStructures)[] | string | WriterFunction | null;
implements?: string[];
decorators?: OptionalKind<DecoratorStructure>[];
ctors?: OptionalKind<ConstructorDeclarationStructure>[];
}
export declare const DEFAULT_ADD_METHOD_CLASS_OPTIONS: Required<AddMethodClassOptions>;
export declare function CoerceMethodClassLegacy(sourceFile: SourceFile, name: string, options?: AddMethodClassOptions): void;
export declare function AddMethodClass(sourceFile: SourceFile, name: string, options?: AddMethodClassOptions): void;