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

Function checkTypeParametersNotReferenced

test/fixtures/snapshot/typescript.js:83983–83998  ·  view source on GitHub ↗

Check that type parameter defaults only reference previously declared type parameters

(root, typeParameters, index)

Source from the content-addressed store, hash-verified

83981 }
83982 /** Check that type parameter defaults only reference previously declared type parameters */
83983 function checkTypeParametersNotReferenced(root, typeParameters, index) {
83984 visit(root);
83985 function visit(node) {
83986 if (node.kind === 178 /* SyntaxKind.TypeReference */) {
83987 var type = getTypeFromTypeReference(node);
83988 if (type.flags & 262144 /* TypeFlags.TypeParameter */) {
83989 for (var i = index; i < typeParameters.length; i++) {
83990 if (type.symbol === getSymbolOfNode(typeParameters[i])) {
83991 error(node, ts.Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters);
83992 }
83993 }
83994 }
83995 }
83996 ts.forEachChild(node, visit);
83997 }
83998 }
83999 /** Check that type parameter lists are identical across multiple declarations */
84000 function checkTypeParameterListsIdentical(symbol) {
84001 if (symbol.declarations && symbol.declarations.length === 1) {

Callers 1

Calls 1

visitFunction · 0.85

Tested by

no test coverage detected