UNPKG

@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

38 lines (37 loc) 1.5 kB
import { ImportDeclarationStructure, OptionalKind } from 'ts-morph'; export declare enum TypeNames { String = "string", Number = "number", Boolean = "boolean", Any = "any", Unknown = "unknown", Self = "<self>", Deferred = "<deferred>" } export type TypeName = string | TypeNames; export interface TypeImport { name: TypeName; moduleSpecifier?: string | null; namedImport?: string | null; namespaceImport?: string | null; isTypeOnly?: boolean | null; defaultImport?: string | null; } export declare function IsTypeImport(value: any): value is TypeImport; export declare function RequiresTypeImport(typeImport: TypeImport): boolean; export declare function TypeImportToImportStructure(typeImport: TypeImport): OptionalKind<ImportDeclarationStructure>; export interface NormalizedTypeImport { /** * The name of the type * <self> indicates a self reference of the next object in the chain * <deferred> indicates that the type is only known at runtime */ name: TypeName; moduleSpecifier: string | null; namedImport: string | null; namespaceImport: string | null; isTypeOnly: boolean | null; defaultImport: string | null; } export declare function NormalizeTypeImport(typeImport?: Readonly<TypeImport> | string, defaultType?: TypeImport | string): NormalizedTypeImport; export declare function NormalizeTypeImportList(typeImportList?: Array<TypeImport | string>, defaultType?: string): NormalizedTypeImport[];