API @deepkit/type-compiler
npm install @deepkit/type-compiler
TypeScript transformer to make runtime type information available at runtime.
Read the TypeScript AST and generate pack struct (instructions + pre-defined stack). This transformer extracts type and add the encoded (so its small and low overhead) at classes and functions as property. Deepkit/type can then extract and decode them on-demand. It can't be more ops than this given numberClasses
export class Cache {
resolver: ReflectionConfigCache;
sourceFiles: {
[fileName: string]: SourceFile;
};
globalSourceFiles?: SourceFile[];
/**
* Signals the cache to check if it needs to be cleared.
*/
tick();
}
export class ReflectionTransformer implements CustomTransformer {
sourceFile: SourceFile;
constructor(protected context: TransformationContext, protected cache: Cache = new Cache);
forHost(host: CompilerHost): this;
withReflection(config: ReflectionConfig): this;
transformBundle(node: Bundle): Bundle;
getTempResultIdentifier(): Identifier;
transformSourceFile(sourceFile: SourceFile): SourceFile;
}
export class DeclarationTransformer extends ReflectionTransformer {
transformSourceFile(sourceFile: SourceFile): SourceFile;
}
export class DeepkitLoader {
constructor();
transform(source: string, path: string): string;
}
Const
number
number
CustomTransformerFactory
CustomTransformerFactory
Functions
(program: Program, opts: {}): { before: CustomTransformerFactory; afterDeclarations: CustomTransformerFactory; }
(ops: ReflectionOp[]): string
(sourceFile: SourceFile, forType: Node, pack: { ops: ReflectionOp[]; stack: PackExpression[]; }): void