Skip to content

Commit 07a2394

Browse files
committed
add types to ErrorReporter
1 parent 2dd9a4a commit 07a2394

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/cubejs-schema-compiler/src/compiler/ErrorReporter.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import { codeFrameColumns, SourceLocation } from '@babel/code-frame';
33
import { UserError } from './UserError';
44
import { CompileError } from './CompileError';
55

6+
export type ErrorLikeObject = {
7+
message: string;
8+
};
9+
10+
export type PossibleError = Error | UserError | string | ErrorLikeObject;
11+
612
export interface CompilerErrorInterface {
713
message: string;
814
plainMessage?: string
@@ -141,16 +147,16 @@ export class ErrorReporter {
141147
return this.rootReporter().errors;
142148
}
143149

144-
public addErrors(errors: any[]) {
150+
public addErrors(errors: PossibleError[]) {
145151
errors.forEach((e: any) => { this.error(e); });
146152
}
147153

148154
public getWarnings() {
149155
return this.rootReporter().warnings;
150156
}
151157

152-
public addWarnings(warnings: any[]) {
153-
warnings.forEach((w: any) => { this.warning(w); });
158+
public addWarnings(warnings: SyntaxErrorInterface[]) {
159+
warnings.forEach(w => { this.warning(w); });
154160
}
155161

156162
protected rootReporter(): ErrorReporter {

0 commit comments

Comments
 (0)