---
title: "TypeshadeDiagnostic: interface in Editor, TypeShade API"
description: "TypeshadeDiagnostic, an interface in Editor. Compiler diagnostic enriched with the source range and span that produced it."
url: https://typeshade.dev/api/typeshadediagnostic/
language: en
---

# `TypeshadeDiagnostic`

Interface in Editor

Compiler diagnostic enriched with the source range and span that produced it.

`import type { TypeshadeDiagnostic } from 'typeshade'`

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

## Syntax

```ts
interface TypeshadeDiagnostic {
  readonly message: string;
  readonly category: 'error' | 'warning' | 'message';
  readonly code?: string;
  readonly fileName: string;
  readonly range: TypeshadeRange;
  readonly span: TypeshadeTextSpan;
}
```

## Description

`span`/`range` come directly from the compiler’s own `start`/`length` (see `TsCompilerDiagnostic` in `src/compiler/ts/source-file.ts`), which already cover the offending node — `node.getStart(sourceFile)` through `node.getEnd()` — or the file’s first statement when the diagnostic has no node behind it. Nothing here recomputes a one-character span from `line`/`character` any more.

## Instance properties

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

Human-readable diagnostic message.

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

Diagnostic severity.

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

Compiler-specific diagnostic code, when the diagnostic carries one.

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

Name of the source file the diagnostic was raised against.

**`range` read only `TypeshadeRange`**

Zero-based half-open range the diagnostic covers.

**`span` read only `TypeshadeTextSpan`**

UTF-16 offset span the diagnostic covers, equivalent to `range`.

## Source

[`src/language-service.ts`, line 50](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service.ts#L50), at commit af54ddad5
