Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Create local Error interface so that node doesn't need to be external…
Browse files Browse the repository at this point in the history
…ly referenced (#1741)
  • Loading branch information
nchen63 authored and adidahiya committed Nov 19, 2016
1 parent b858cae commit 33019aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ export interface IConfigurationFile {
rules?: any;
}

/**
* Define `Error` here to avoid using `Error` from @types/node.
* Using the `node` version causes a compilation error when this code is used as an npm library if @types/node is not already imported.
*/
export interface Error {
message: string;
}

export interface IConfigurationLoadResult {
error?: Error;
path: string;
Expand Down
4 changes: 3 additions & 1 deletion src/test/lintError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

import { Error } from "../configuration";

export interface PositionInFile {
line: number;
col: number;
Expand All @@ -40,5 +42,5 @@ export function errorComparator(err1: LintError, err2: LintError) {
}

export function lintSyntaxError(message: string) {
return new Error(`Lint File Syntax Error: ${message}`);
return new Error(`Lint File Syntax Error: ${message}`) as Error;
}

0 comments on commit 33019aa

Please sign in to comment.