@rxap/ts-morph
Version:
Provides utilities for manipulating TypeScript code using the ts-morph library. It offers a fluent API to add, modify, and remove code elements such as classes, decorators, imports, and properties in both Angular and NestJS projects. This package simplifi
23 lines (22 loc) • 1.21 kB
TypeScript
import { Normalized } from '@rxap/utilities';
import { OptionalKind, PropertySignatureStructure, SourceFile } from 'ts-morph';
import { NormalizedTypeImport, TypeImport, TypeName } from './type-import';
export interface DataProperty {
name: string;
type?: TypeImport | TypeName;
isArray?: boolean;
isOptional?: boolean;
source?: string | null;
/**
* If set the property is an object with the given members
*/
memberList?: Array<string | DataProperty>;
}
export interface NormalizedDataProperty extends Readonly<Normalized<Omit<DataProperty, 'memberList'>>> {
type: NormalizedTypeImport;
source: string | null;
memberList: Array<NormalizedDataProperty>;
}
export declare function NormalizeDataProperty(property: TypeName | Readonly<DataProperty>, defaultType?: TypeImport | TypeName, isArray?: boolean): NormalizedDataProperty;
export declare function NormalizeDataPropertyList(propertyList?: Array<string | DataProperty>, defaultType?: TypeImport | TypeName): Array<NormalizedDataProperty>;
export declare function NormalizeDataPropertyToPropertySignatureStructure(property: DataProperty, sourceFile: SourceFile): OptionalKind<PropertySignatureStructure>;