Migrate Babel from Flow to TypeScript (except Babel parser) (#11578)

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
Bogdan Savluk
2021-11-25 23:09:13 +01:00
committed by GitHub
parent 473f145b27
commit 0058b7fef4
162 changed files with 672 additions and 133 deletions

View File

@@ -1,5 +1,7 @@
import { declare } from "@babel/helper-plugin-utils";
import syntaxNumericSeparator from "@babel/plugin-syntax-numeric-separator";
import type { NodePath } from "@babel/traverse";
import type * as t from "@babel/types";
/**
* Given a bigIntLiteral or NumericLiteral, remove numeric
@@ -7,9 +9,11 @@ import syntaxNumericSeparator from "@babel/plugin-syntax-numeric-separator";
*
* @param {NodePath<BigIntLiteral | NumericLiteral>} { node }: A Babel AST node path
*/
function remover({ node }: NodePath<BigIntLiteral | NumericLiteral>) {
function remover({ node }: NodePath<t.BigIntLiteral | t.NumericLiteral>) {
const { extra } = node;
// @ts-expect-error todo(flow->ts)
if (extra?.raw?.includes("_")) {
// @ts-expect-error todo(flow->ts)
extra.raw = extra.raw.replace(/_/g, "");
}
}