Skip to content

Commit

Permalink
Fix definition of DiagnosticCallback. Fixes peggyjs#283.
Browse files Browse the repository at this point in the history
  • Loading branch information
hildjj committed Jun 9, 2022
1 parent f9cd8c6 commit 1a3e05b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 45 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Released: TBD

### Bug Fixes

- None
- [#283](https://github.com/peggyjs/peggy/issues/283) Fix incorrect type
information for DiagnosticCallback, from @hildjj

2.0.1
-----
Expand Down
58 changes: 14 additions & 44 deletions lib/peg.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -997,50 +997,20 @@ export interface Session {
): void;
}

export interface DiagnosticCallback {
/**
* Called when compiler reports an error.
*
* @param stage Stage in which this diagnostic was originated
* @param message Main message, which should describe error objectives
* @param location If defined, this is location described in the `message`
* @param notes Additional messages with context information
*/
error?(
stage: Stage,
message: string,
location?: LocationRange,
notes?: DiagnosticNote[]
): void;
/**
* Called when compiler reports a warning.
*
* @param stage Stage in which this diagnostic was originated
* @param message Main message, which should describe warning objectives
* @param location If defined, this is location described in the `message`
* @param notes Additional messages with context information
*/
warning?(
stage: Stage,
message: string,
location?: LocationRange,
notes?: DiagnosticNote[]
): void;
/**
* Called when compiler reports an informational message.
*
* @param stage Stage in which this diagnostic was originated
* @param message Main message, which gives information about an event
* @param location If defined, this is location described in the `message`
* @param notes Additional messages with context information
*/
info?(
stage: Stage,
message: string,
location?: LocationRange,
notes?: DiagnosticNote[]
): void;
}
/**
* Called when compiler reports an error, warning, or info.
*
* @param stage Stage in which this diagnostic was originated
* @param message Main message, which should describe error objectives
* @param location If defined, this is location described in the `message`
* @param notes Additional messages with context information
*/
export type DiagnosticCallback = (
stage: Stage,
message: string,
location?: LocationRange,
notes?: DiagnosticNote[]
) => void;

/**
* Parser dependencies, is an object which maps variables used to access the
Expand Down

0 comments on commit 1a3e05b

Please sign in to comment.