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

Function checkGrammarArrowFunction

test/fixtures/snapshot/typescript.js:88108–88121  ·  view source on GitHub ↗
(node, file)

Source from the content-addressed store, hash-verified

88106 checkGrammarTypeParameterList(node.typeParameters, file);
88107 }
88108 function checkGrammarArrowFunction(node, file) {
88109 if (!ts.isArrowFunction(node)) {
88110 return false;
88111 }
88112 if (node.typeParameters && !(ts.length(node.typeParameters) > 1 || node.typeParameters.hasTrailingComma || node.typeParameters[0].constraint)) {
88113 if (file && ts.fileExtensionIsOneOf(file.fileName, [".mts" /* Extension.Mts */, ".cts" /* Extension.Cts */])) {
88114 grammarErrorOnNode(node.typeParameters[0], ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint);
88115 }
88116 }
88117 var equalsGreaterThanToken = node.equalsGreaterThanToken;
88118 var startLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.pos).line;
88119 var endLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.end).line;
88120 return startLine !== endLine && grammarErrorOnNode(equalsGreaterThanToken, ts.Diagnostics.Line_terminator_not_permitted_before_arrow);
88121 }
88122 function checkGrammarIndexSignatureParameters(node) {
88123 var parameter = node.parameters[0];
88124 if (node.parameters.length !== 1) {

Callers 1

Calls 2

grammarErrorOnNodeFunction · 0.85
lengthMethod · 0.45

Tested by

no test coverage detected