Skip to content

Commit

Permalink
fix: createLiteral removed in 5.1 microsoft/TypeScript#53077 (comment) (
Browse files Browse the repository at this point in the history
#1574)

* fix: createLiteral removed in 5.1 microsoft/TypeScript#53077 (comment)

* fix: factory
  • Loading branch information
johnnyreilly authored Mar 4, 2023
1 parent 9aa5b52 commit 5f28651
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var transformer = function (context) {
if (node.kind === ts.SyntaxKind.StringLiteral) {
var text = node.text;
if (text !== text.toUpperCase()) {
return ts.createLiteral(text.toUpperCase());
// createLiteral removed in 5.1 https://github.com/microsoft/TypeScript/issues/53077#issuecomment-1453846217
return ts.createLiteral ? ts.createLiteral(text.toUpperCase()) : ts.factory.createStringLiteral(text.toUpperCase());
}
}
return ts.visitEachChild(node, visitor, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var transformer = function (context) {
if (node.kind === ts.SyntaxKind.StringLiteral) {
var text = node.text;
if (text !== text.toUpperCase()) {
return ts.createLiteral(text.toUpperCase());
// createLiteral removed in 5.1 https://github.com/microsoft/TypeScript/issues/53077#issuecomment-1453846217
return ts.createLiteral ? ts.createLiteral(text.toUpperCase()) : ts.factory.createStringLiteral(text.toUpperCase());
}
}
return ts.visitEachChild(node, visitor, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ var transformer = function (context) {
var text = node.text;
if (text.match(/^Hello from submodule/) !== null) {
if (text !== text.toUpperCase()) {
return ts.createLiteral(text.toUpperCase());
// https://github.com/microsoft/TypeScript/issues/53077#issuecomment-1453846217
return ts.createLiteral ? ts.createLiteral(text.toUpperCase()) : ts.factory.createStringLiteral(text.toUpperCase());
}
}
}
Expand Down

0 comments on commit 5f28651

Please sign in to comment.