---
title: "CompileTsSourceResult: interface in Authoring, TypeShade API"
description: "CompileTsSourceResult, an interface in Authoring. The result of compiling a TypeShade TypeScript source string, including IR and optional WGSL."
url: https://typeshade.dev/api/compiletssourceresult/
language: en
---

# `CompileTsSourceResult`

Interface in Authoring

The result of compiling a TypeShade TypeScript source string, including IR and optional WGSL.

`import type { CompileTsSourceResult } from 'typeshade'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
interface CompileTsSourceResult {
  readonly hasDirective: boolean;
  readonly funcs: readonly FuncDecl[];
  readonly diagnostics: readonly TsCompilerDiagnostic[];
  readonly sourceFile: ts.SourceFile;
  readonly consts: readonly ConstDecl[];
  readonly bindings: readonly BindingDecl[];
  readonly structs: readonly CollectedStruct[];
  readonly overrides: readonly OverrideDecl[];
  readonly vars: readonly ModuleVarDecl[];
  readonly enables: readonly DeclarableCapability[];
  readonly symbols: readonly DeclaredSymbol[];
  readonly expressions: readonly LoweredExpression[];
  readonly wgsl?: string;
}
```

## Instance properties

**`hasDirective` read only `boolean`**

**`funcs` read only `readonly FuncDecl[]`**

**`diagnostics` read only `readonly TsCompilerDiagnostic[]`**

**`sourceFile` read only `ts.SourceFile`**

**`consts` read only `readonly ConstDecl[]`**

**`bindings` read only `readonly BindingDecl[]`**

**`structs` read only `readonly CollectedStruct[]`**

**`overrides` read only `readonly OverrideDecl[]`**

Every `override<T>` the module declares — WGSL specialization constants, which the pipeline sets and no pass folds. Empty for a module that declares none.

**`vars` read only `readonly ModuleVarDecl[]`**

Every module variable (`let x: workgroup<T>`, `let y: T = init`, §24) the module declares. Empty for a module that declares none.

**`enables` read only `readonly DeclarableCapability[]`**

The capabilities the file’s `"enable <extension>";` directives turn on (§50), by neutral id. Empty for a file that enables nothing, which is most; the two extension-gated `@builtin(...)` ids do not need one, since `requiredCaps` derives their capability from the use.

**`symbols` read only `readonly DeclaredSymbol[]`**

Every name the front end declared while lowering `sourceFile`, with the `ShaderType` it gave it and the UTF-16 span of the declared name: the table an editor answers “what type is this symbol” from, since TypeScript infers plain `number` for a numeric literal that the compiler types `f32`. Empty when nothing was lowered (no directive, a parse error). A side output: nothing here feeds lowering, the IR or emitted text. See `DeclaredSymbol`.

**`expressions` read only `readonly LoweredExpression[]`**

Every expression the front end lowered in `sourceFile`, with the `ShaderType` it gave it and its UTF-16 span, in source order: the table an editor’s own type for an expression is held to ([Rule 12.7](https://typeshade.dev/reference/rules/12-7/), 0015). A span lowered to two types is left out, and a refused expression records nothing. Empty when nothing was lowered. A side output, like `symbols`: nothing here feeds lowering, the IR or emitted text. See `LoweredExpression`.

**`wgsl` optional read only `string`**

## Source

[`src/compiler/ts/source-file.ts`, line 143](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/source-file.ts#L143), at commit af54ddad5
