Created
January 18, 2019 00:45
-
-
Save sbdchd/82c961f64035708ce289652458f922c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isValidPropertyName(node: ts.ComputedPropertyName): boolean { | |
if ( | |
ts.isStringLiteral(node.expression) && | |
isValidEs6Identifier(node.expression.text) | |
) { | |
return true | |
} | |
if (ts.isNumericLiteral(node.expression)) { | |
return true | |
} | |
return false | |
} | |
function isValidPropertyName2(node: ts.ComputedPropertyName): boolean { | |
return ( | |
(ts.isStringLiteral(node.expression) && | |
isValidEs6Identifier(node.expression.text)) || | |
ts.isNumericLiteral(node.expression) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment