Migrate Babel from Flow to TypeScript (except Babel parser) (#11578)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
@@ -37,7 +37,7 @@ ERROR: Dynamic import() transformation must be enabled using the
|
||||
//todo: use getExportSpecifierName in `helper-module-transforms` when this library is refactored to NodePath usage.
|
||||
|
||||
export function getExportSpecifierName(
|
||||
node: Node,
|
||||
node: t.Node,
|
||||
stringSpecifiers: Set<string>,
|
||||
): string {
|
||||
if (node.type === "Identifier") {
|
||||
@@ -61,15 +61,14 @@ export function getExportSpecifierName(
|
||||
}
|
||||
}
|
||||
|
||||
type PluginState = {|
|
||||
contextIdent: string,
|
||||
|
||||
type PluginState = {
|
||||
contextIdent: string;
|
||||
// List of names that should only be printed as string literals.
|
||||
// i.e. `import { "any unicode" as foo } from "some-module"`
|
||||
// `stringSpecifiers` is Set(1) ["any unicode"]
|
||||
// In most cases `stringSpecifiers` is an empty Set
|
||||
stringSpecifiers: Set<string>,
|
||||
|};
|
||||
stringSpecifiers: Set<string>;
|
||||
};
|
||||
|
||||
function constructExportCall(
|
||||
path,
|
||||
@@ -333,7 +332,7 @@ export default declare((api, options) => {
|
||||
const exportNames = [];
|
||||
const exportValues = [];
|
||||
|
||||
const body: Array<Object> = path.get("body");
|
||||
const body: Array<any> = path.get("body");
|
||||
|
||||
for (const path of body) {
|
||||
if (path.isFunctionDeclaration()) {
|
||||
@@ -563,6 +562,7 @@ export default declare((api, options) => {
|
||||
});
|
||||
|
||||
let moduleName = getModuleName(this.file.opts, options);
|
||||
// @ts-expect-error todo(flow->ts): do not reuse variables
|
||||
if (moduleName) moduleName = t.stringLiteral(moduleName);
|
||||
|
||||
hoistVariables(
|
||||
Reference in New Issue
Block a user