MCPcopy Index your code
hub / github.com/nodejs/node / tryGetPropertyName

Function tryGetPropertyName

test/fixtures/snapshot/typescript.js:151340–151354  ·  view source on GitHub ↗
(node, compilerOptions, quotePreference)

Source from the content-addressed store, hash-verified

151338 return false;
151339 }
151340 function tryGetPropertyName(node, compilerOptions, quotePreference) {
151341 if (ts.isPropertyAccessExpression(node)) {
151342 return node.name;
151343 }
151344 var propName = node.argumentExpression;
151345 if (ts.isNumericLiteral(propName)) {
151346 return propName;
151347 }
151348 if (ts.isStringLiteralLike(propName)) {
151349 return ts.isIdentifierText(propName.text, ts.getEmitScriptTarget(compilerOptions)) ? ts.factory.createIdentifier(propName.text)
151350 : ts.isNoSubstitutionTemplateLiteral(propName) ? ts.factory.createStringLiteral(propName.text, quotePreference === 0 /* QuotePreference.Single */)
151351 : propName;
151352 }
151353 return undefined;
151354 }
151355 })(codefix = ts.codefix || (ts.codefix = {}));
151356})(ts || (ts = {}));
151357/* @internal */

Callers 1

createClassElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected