github
DocsBlog
fontcolor_theme
package

API @deepkit/type-compiler

npm install @deepkit/type-compiler

TypeScript transformer to make runtime type information available at runtime.

Classes

Cache [source]
export class Cache {
    resolver: ReflectionConfigCache;
    sourceFiles: {
        [fileName: string]: SourceFile;
    };
    globalSourceFiles?: SourceFile[];
    /**
     * Signals the cache to check if it needs to be cleared.
     */
    tick();
}
ReflectionTransformer [source]
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;
}

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.

DeclarationTransformer [source]
export class DeclarationTransformer extends ReflectionTransformer {
    transformSourceFile(sourceFile: SourceFile): SourceFile;
}
DeepkitLoader [source]
export class DeepkitLoader {
    constructor();
    transform(source: string, path: string): string;
}

Const

packSizeByte [source]
number
packSize [source]
number

It can't be more ops than this given number

transformer [source]
CustomTransformerFactory
declarationTransformer [source]
CustomTransformerFactory

Functions

default [source]
(program: Program, opts: {}): { before: CustomTransformerFactory; afterDeclarations: CustomTransformerFactory; }
encodeOps [source]
(ops: ReflectionOp[]): string
debugPackStruct [source]
(sourceFile: SourceFile, forType: Node, pack: { ops: ReflectionOp[]; stack: PackExpression[]; }): void