Skip to content

Commit 40972ba

Browse files
author
Andy Hanson
committed
Move isStringOrNumericLiteral closer to its only use
1 parent 924890a commit 40972ba

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/compiler/factory.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -4709,7 +4709,7 @@ namespace ts {
47094709
/**
47104710
* Gets the property name of a BindingOrAssignmentElement
47114711
*/
4712-
export function getPropertyNameOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement) {
4712+
export function getPropertyNameOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): PropertyName | undefined {
47134713
switch (bindingElement.kind) {
47144714
case SyntaxKind.BindingElement:
47154715
// `a` in `let { a: b } = ...`
@@ -4754,6 +4754,12 @@ namespace ts {
47544754
Debug.fail("Invalid property name for binding element.");
47554755
}
47564756

4757+
function isStringOrNumericLiteral(node: Node): node is StringLiteral | NumericLiteral {
4758+
const kind = node.kind;
4759+
return kind === SyntaxKind.StringLiteral
4760+
|| kind === SyntaxKind.NumericLiteral;
4761+
}
4762+
47574763
/**
47584764
* Gets the elements of a BindingOrAssignmentPattern
47594765
*/

src/compiler/utilities.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -2560,14 +2560,8 @@ namespace ts {
25602560
return false;
25612561
}
25622562

2563-
export function isStringOrNumericLiteral(node: Node): node is StringLiteral | NumericLiteral {
2564-
const kind = node.kind;
2565-
return kind === SyntaxKind.StringLiteral
2566-
|| kind === SyntaxKind.NumericLiteral;
2567-
}
2568-
25692563
export function isStringOrNumericLiteralLike(node: Node): node is StringLiteralLike | NumericLiteral {
2570-
return isStringOrNumericLiteral(node) || isNoSubstitutionTemplateLiteral(node);
2564+
return isStringLiteralLike(node) || isNumericLiteral(node);
25712565
}
25722566

25732567
/**

0 commit comments

Comments
 (0)