# API `@deepkit/type-compiler`

```shell
npm install @deepkit/type-compiler
```

TypeScript transformer, um Laufzeit-Typinformationen zur Laufzeit verfügbar zu machen.

## API reference of @deepkit/type-compiler

### default (function)

```typescript
(program: Program, opts: {}): { before: import("typescript").CustomTransformerFactory; afterDeclarations: import("typescript").CustomTransformerFactory; }
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/index.ts#L18

### encodeOps (function)

```typescript
(ops: ReflectionOp[]): string
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/compiler.ts#L178

### debugPackStruct (function)

```typescript
(sourceFile: SourceFile, forType: Node, pack: { ops: ReflectionOp[]; stack: PackExpression[]; }): void
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/compiler.ts#L229

### packSizeByte (variable)

```typescript
number
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/compiler.ts#L186

### packSize (variable)

It can't be more ops than this given number

```typescript
number
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/compiler.ts#L193

### Cache (class)

```typescript
export class Cache {
    resolver: ReflectionConfigCache;
    sourceFiles: {
        [fileName: string]: SourceFile;
    };
    globalSourceFiles?: SourceFile[];
    /**
     * Signals the cache to check if it needs to be cleared.
     */
    tick();
}
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/compiler.ts#L514

### ReflectionTransformer (class)

```typescript
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;
    attachAdditionalStatements(statements: NodeArray<Statement> | Statement[]): Statement[];
}
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/compiler.ts#L618

### DeclarationTransformer (class)

```typescript
export class DeclarationTransformer extends ReflectionTransformer {
    transformSourceFile(sourceFile: SourceFile): SourceFile;
}
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/compiler.ts#L3712

### transformer (function)

```typescript
CustomTransformerFactory
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/compiler.ts#L3780

### declarationTransformer (function)

```typescript
CustomTransformerFactory
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/compiler.ts#L3789

### DeepkitLoader (class)

```typescript
export class DeepkitLoader {
    constructor();
    transform(source: string, path: string): string;
}
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/loader.ts#L5

### expandBraces (function)

Expands brace patterns like `{a,b}` and `{1..3}` into a list of patterns.

```typescript
(pattern: string): string[]
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/filter.ts#L86

### globToRegExp (function)

Converts a glob pattern to a regular expression.

Supports `*`, `**`, `?`, `[abc]`, `[!abc]`, `[a-z]`, `{a,b}`, `{1..3}`, and backslash escapes.

```typescript
(pattern: string, options?: GlobOptions): RegExp
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/filter.ts#L192

### isGlobMatch (function)

Returns true if path matches any of the given glob patterns and none of the ignore patterns.

```typescript
(path: string, patterns: string | string[], ignore?: string[], options?: GlobOptions): boolean
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/filter.ts#L217

### createFilter (function)

Creates a filter function for file ids, compatible with rollup's `createFilter`.

A file matches if it matches no exclude and at least one include pattern (or include is empty).
Relative glob patterns are resolved against `options.resolve` (default the current working directory).

```typescript
(include?: FilterPattern, exclude?: FilterPattern, options?: { resolve?: string | false | null; }): (id: unknown) => boolean
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/filter.ts#L258

### FilterPattern (type)

Glob pattern, regular expression, or a list of them. Same as rollup's FilterPattern.

```typescript
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/filter.ts#L6

### GlobOptions (type)

```typescript
interface GlobOptions {
    /**
     * When true, wildcards also match path segments starting with a dot (e.g. `.git`).
     */
    dot?: boolean;
}
```

Source: https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/filter.ts#L8
