Skip to content

Commit

Permalink
feat: deprecate calling top-level import as a function
Browse files Browse the repository at this point in the history
  • Loading branch information
djcsdy committed Oct 12, 2022
1 parent 1d18388 commit 319a4a7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fix-types-for-back-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ const fix = context => node => {
typescript.factory.createModuleBlock([node]),
typescript.NodeFlags.Namespace
);
} else if (typescript.isFunctionDeclaration(node) && node.name.escapedText === "chain") {
console.log("found function decl");
return typescript.addSyntheticLeadingComment(
typescript.visitEachChild(node, visit, context),
typescript.SyntaxKind.MultiLineCommentTrivia,
'* @deprecated Use `import { chain } from "chain"` instead of `import chain = require("chain")`.\n' +
" * Will be removed in v3.0. ",
true
);
} else if (typescript.isModuleDeclaration(node) && node.name.escapedText === "chain") {
return typescript.visitEachChild(node, visitInModuleDeclaration, context);
} else {
Expand Down

0 comments on commit 319a4a7

Please sign in to comment.