---
title: "TsCompilerDiagnostic: TypeShade 셰이더 API의 작성 분류 인터페이스 참조 문서"
description: "TsCompilerDiagnostic, TypeShade API의 작성 분류에 속하는 인터페이스입니다. TypeShade가 TypeScript 셰이더 코드를 분석하거나 컴파일할 때 만드는 소스 진단입니다."
url: https://typeshade.dev/ko/api/tscompilerdiagnostic/
language: ko
---

# `TsCompilerDiagnostic`

인터페이스, 작성 분류

TypeShade가 TypeScript 셰이더 코드를 분석하거나 컴파일할 때 만드는 소스 진단입니다.

`import type { TsCompilerDiagnostic } from 'typeshade'`

설명은 커밋 af54ddad5의 검토된 컴파일러 문서를 번역한 것입니다. 시그니처와 예제 코드는 원문을 따르며, 필요한 경우 설명에 편집상 수정이 반영됩니다.

## 구문

```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;
}
```

## 설명

`line`/`character`는 1부터 시작하며, 외부 도구(`language-service.ts`를 포함한다)가 이 값을 읽습니다. 두 값은 문제가 된 노드의 시작 위치를 나타냅니다. `start`와 `length`는 파일 안의 UTF-16 오프셋입니다. 각각 `node.getStart(sourceFile)`과 `node.getEnd() - node.getStart(sourceFile)`에 해당합니다. 그래서 편집기는 글자 하나가 아니라 노드 전체에 밑줄을 그을 수 있습니다. `endLine`/`endCharacter`는 `start + length` 위치를 1부터 세며, `line`/`character`와 같은 규칙을 따릅니다.

노드가 없는 진단(지시문 누락, 모듈 전체 백엔드 실패)은 파일의 첫 문장을 범위로 씁니다. 파일에 문장이 없으면 `start: 0, length: 0`을 씁니다. 구현은 `diagnostic.ts`의 `makeDiagnostic`에 있습니다.

## 인스턴스 속성

**`message` 읽기 전용 `string`**

**`fileName` 읽기 전용 `string`**

**`line` 읽기 전용 `number`**

**`character` 읽기 전용 `number`**

**`category` 읽기 전용 `'error' | 'warning' | 'message'`**

**`code` 선택 사항 읽기 전용 `string`**

**`start` 읽기 전용 `number`**

진단 범위가 시작하는 UTF-16 오프셋입니다.

**`length` 읽기 전용 `number`**

진단 범위의 길이이며, UTF-16 코드 단위로 셉니다.

**`endLine` 읽기 전용 `number`**

`start + length` 위치의 줄 번호이며, 1부터 시작합니다.

**`endCharacter` 읽기 전용 `number`**

`start + length` 위치의 문자 번호이며, 1부터 시작합니다.

## 소스

[`src/compiler/ts/diagnostic.ts`, 17행](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/diagnostic.ts#L17), 커밋 af54ddad5 기준
