Diagnostic
이 페이지에서

Diagnostic

인터페이스, 진단 분류

One problem reported by a lint rule or by validation.

import type { Diagnostic } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

interface Diagnostic {
readonly ruleId: string;
readonly severity: 'error' | 'warning';
readonly message: string;
readonly fn?: string;
readonly code?: string;
readonly loc?: SourceLoc;
readonly hint?: string;
}

설명

ruleId, severity and message are always present; the other fields are filled in when the reporting rule had the information.

loc points at the TypeScript that built the offending node. It is present only when source tracing (setSourceTracing) was on while the module was authored, so by default it is absent. code is an SD#### code from the same catalogue thrown errors use (CODES), present on rules that map onto one. Tooling should branch on code or ruleId, since message is free text.

인스턴스 속성

ruleId읽기 전용 string

Id of the rule that reported the problem, for example 'param-count'.

severity읽기 전용 'error' | 'warning'

'error' or 'warning'. A rule configured 'off' reports nothing, so no diagnostic carries that value.

message읽기 전용 string

Human-readable description of the problem. Free text; branch on code or ruleId instead.

fn선택 사항읽기 전용 string

Name of the function the problem was found in, when the rule reported one. Module-level problems leave it unset.

code선택 사항읽기 전용 string

Stable diagnostic code (SD####) from CODES, for tooling and documentation links.

loc선택 사항읽기 전용 SourceLoc

Where in the authored TypeScript the offending node was built. Present only when source tracing (setSourceTracing) was on at the time.

hint선택 사항읽기 전용 string

One-line suggestion for how to fix the problem.

소스

src/core/passes/lint/engine.ts, 36행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고