---
title: "TsCompilerDiagnostic: interface in Authoring, TypeShade API"
description: "TsCompilerDiagnostic, an interface in Authoring. A source diagnostic produced while TypeShade analyzes or compiles TypeScript shader code."
url: https://typeshade.dev/api/tscompilerdiagnostic/
language: en
---

# `TsCompilerDiagnostic`

Interface in Authoring

A source diagnostic produced while TypeShade analyzes or compiles TypeScript shader code.

`import type { TsCompilerDiagnostic } from 'typeshade'`

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

## Syntax

```ts
interface TsCompilerDiagnostic {
  readonly message: string;
  readonly fileName: string;
  readonly line: number;
  readonly character: number;
  readonly category: 'error' | 'warning' | 'message';
  readonly code?: string;
  readonly start: number;
  readonly length: number;
  readonly endLine: number;
  readonly endCharacter: number;
}
```

## Description

`line`/`character` are one-based (external consumers, including `language-service.ts`, read these) and mark the start of the offending node. `start`/`length` are UTF-16 offsets into the file — `node.getStart(sourceFile)` and `node.getEnd() - node.getStart(sourceFile)` — so an editor can underline the whole node rather than a single character; `endLine`/`endCharacter` are the one-based position of `start + length`, in the same convention as `line`/`character`. A diagnostic with no node behind it (a missing directive, a whole-module backend failure) uses the file’s first statement as its span, or `start: 0, length: 0` when the file has none — see `makeDiagnostic` in `diagnostic.ts`.

## Instance properties

**`message` read only `string`**

**`fileName` read only `string`**

**`line` read only `number`**

**`character` read only `number`**

**`category` read only `'error' | 'warning' | 'message'`**

**`code` optional read only `string`**

**`start` read only `number`**

UTF-16 offset where the diagnostic’s span begins.

**`length` read only `number`**

Length of the diagnostic’s span, in UTF-16 code units.

**`endLine` read only `number`**

One-based line of the position `start + length`.

**`endCharacter` read only `number`**

One-based character of the position `start + length`.

## Source

[`src/compiler/ts/diagnostic.ts`, line 17](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/diagnostic.ts#L17), at commit af54ddad5
