convert @babel/highlight to typescript (#12432)

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
Bogdan Savluk
2021-02-25 01:38:47 +01:00
committed by GitHub
parent 4fa7a72874
commit 0a4dc05806
5 changed files with 60 additions and 13 deletions

View File

@@ -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
View 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";
}