convert @babel/code-frame to typescript (#12433)
This commit is contained in:
@@ -59,3 +59,60 @@ declare module "@babel/helper-annotate-as-pure" {
|
||||
}
|
||||
): void;
|
||||
}
|
||||
|
||||
declare module "@babel/code-frame" {
|
||||
declare type Location = {
|
||||
column: number,
|
||||
line: number,
|
||||
};
|
||||
declare type NodeLocation = {
|
||||
end?: Location,
|
||||
start: Location,
|
||||
};
|
||||
declare export interface Options {
|
||||
/**
|
||||
* Syntax highlight the code as JavaScript for terminals. default: false
|
||||
*/
|
||||
highlightCode?: boolean;
|
||||
|
||||
/**
|
||||
* The number of lines to show above the error. default: 2
|
||||
*/
|
||||
linesAbove?: number;
|
||||
|
||||
/**
|
||||
* The number of lines to show below the error. default: 3
|
||||
*/
|
||||
linesBelow?: number;
|
||||
|
||||
/**
|
||||
* Forcibly syntax highlight the code as JavaScript (for non-terminals);
|
||||
* overrides highlightCode.
|
||||
* default: false
|
||||
*/
|
||||
forceColor?: boolean;
|
||||
|
||||
/**
|
||||
* Pass in a string to be displayed inline (if possible) next to the
|
||||
* highlighted location in the code. If it can't be positioned inline,
|
||||
* it will be placed above the code frame.
|
||||
* default: nothing
|
||||
*/
|
||||
message?: string;
|
||||
}
|
||||
declare export function codeFrameColumns(
|
||||
rawLines: string,
|
||||
loc: NodeLocation,
|
||||
opts?: Options
|
||||
): string;
|
||||
|
||||
/**
|
||||
* Create a code frame, adding line numbers, code highlighting, and pointing to a given position.
|
||||
*/
|
||||
declare export default function codeFrame(
|
||||
rawLines: string,
|
||||
lineNumber: number,
|
||||
colNumber?: number | null,
|
||||
opts?: Options
|
||||
): string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user