refactor: move @babel/helper-validator-option to ts (#12410)

This commit is contained in:
Huáng Jùnliàng
2020-12-15 05:56:14 -05:00
committed by GitHub
parent 581aeb9a23
commit 73f30329a6
4 changed files with 34 additions and 13 deletions

View File

@@ -133,3 +133,27 @@ declare module "@babel/helper-validator-identifier" {
declare function isIdentifierChar(code: number): boolean;
declare function isIdentifierName(name: string): boolean;
}
declare module "@babel/helper-validator-option" {
declare class OptionValidator {
descriptor: string;
constructor(descriptor: string): OptionValidator;
validateTopLevelOptions(options: Object, TopLevelOptionShape: Object): void;
validateBooleanOption<T>(
name: string,
value?: boolean,
defaultValue?: T
): boolean | T;
validateStringOption<T>(
name: string,
value?: string,
defaultValue?: T
): string | T;
invariant(condition: boolean, message: string): void;
formatMessage(message: string): string;
}
declare function findSuggestion(
str: string,
arr: $ReadonlyArray<string>
): string;
}