convert @babel/highlight to typescript (#12432)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
@@ -177,3 +177,25 @@ declare module "@babel/generator" {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module "@babel/highlight" {
|
||||
import typeof { Chalk } from "chalk";
|
||||
declare type Options = {
|
||||
forceColor?: boolean,
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether the code should be highlighted given the passed options.
|
||||
*/
|
||||
declare function shouldHighlight(options: Options): boolean;
|
||||
|
||||
/**
|
||||
* The Chalk instance that should be used given the passed options.
|
||||
*/
|
||||
declare function getChalk(options: Options): Chalk;
|
||||
|
||||
/**
|
||||
* Highlight `code`.
|
||||
*/
|
||||
declare export default function highlight(code: string, options?: Options): string;
|
||||
declare export { getChalk, shouldHighlight };
|
||||
}
|
||||
|
||||
5
lib/third-party-libs.d.ts
vendored
Normal file
5
lib/third-party-libs.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare module "js-tokens" {
|
||||
// TODO(Babel 8): Remove this
|
||||
export { default } from "js-tokens-BABEL_8_BREAKING-true";
|
||||
export * from "js-tokens-BABEL_8_BREAKING-true";
|
||||
}
|
||||
Reference in New Issue
Block a user