From 7f9681c953f54ac0594941267247c15168e386e9 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Tue, 16 Feb 2021 15:39:07 -0500 Subject: [PATCH 1/2] fix: reexport Source, Range and DiagnosticMessage from compiler This means any tool which imports the types from both, e.g. vistor-as there will be one source of truth --- cli/asc.d.ts | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/cli/asc.d.ts b/cli/asc.d.ts index bb60c5008c..b17070c972 100644 --- a/cli/asc.d.ts +++ b/cli/asc.d.ts @@ -4,6 +4,8 @@ */ import { OptionDescription } from "./util/options"; +import { Source, Range, DiagnosticMessage } from ".."; + export { OptionDescription }; /** Ready promise resolved once/if the compiler is ready. */ @@ -56,34 +58,13 @@ export interface MemoryStream extends OutputStream { } /** Relevant subset of the Source class for diagnostic reporting. */ -export interface Source { - /** Normalized path with file extension. */ - normalizedPath: string; -} +export { Source } /** Relevant subset of the Range class for diagnostic reporting. */ -export interface Range { - /** Start offset within the source file. */ - start: number; - /** End offset within the source file. */ - end: number; - /** Respective source file. */ - source: Source; -} +export { Range } /** Relevant subset of the DiagnosticMessage class for diagnostic reporting. */ -export interface DiagnosticMessage { - /** Message code. */ - code: number; - /** Message category. */ - category: number; - /** Message text. */ - message: string; - /** Respective source range, if any. */ - range: Range | null; - /** Related range, if any. */ - relatedRange: Range | null; -} +export { DiagnosticMessage } /** A function handling diagnostic messages. */ type DiagnosticReporter = (diagnostic: DiagnosticMessage) => void; From bfbe95a54d979f46114b7a60be3501094c97530b Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Tue, 16 Feb 2021 16:02:24 -0500 Subject: [PATCH 2/2] chore: fix formatting and move reexports to the top to make it clearer --- cli/asc.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/asc.d.ts b/cli/asc.d.ts index b17070c972..2175c78c04 100644 --- a/cli/asc.d.ts +++ b/cli/asc.d.ts @@ -8,6 +8,15 @@ import { Source, Range, DiagnosticMessage } from ".."; export { OptionDescription }; +/** Relevant subset of the Source class for diagnostic reporting. */ +export { Source }; + +/** Relevant subset of the Range class for diagnostic reporting. */ +export { Range }; + +/** Relevant subset of the DiagnosticMessage class for diagnostic reporting. */ +export { DiagnosticMessage }; + /** Ready promise resolved once/if the compiler is ready. */ export const ready: Promise; @@ -57,15 +66,6 @@ export interface MemoryStream extends OutputStream { toString(): string; } -/** Relevant subset of the Source class for diagnostic reporting. */ -export { Source } - -/** Relevant subset of the Range class for diagnostic reporting. */ -export { Range } - -/** Relevant subset of the DiagnosticMessage class for diagnostic reporting. */ -export { DiagnosticMessage } - /** A function handling diagnostic messages. */ type DiagnosticReporter = (diagnostic: DiagnosticMessage) => void;