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

Function checkTypeParameter

test/fixtures/snapshot/typescript.js:80015–80036  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

80013 }
80014 // DECLARATION AND STATEMENT TYPE CHECKING
80015 function checkTypeParameter(node) {
80016 // Grammar Checking
80017 checkGrammarModifiers(node);
80018 if (node.expression) {
80019 grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected);
80020 }
80021 checkSourceElement(node.constraint);
80022 checkSourceElement(node.default);
80023 var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
80024 // Resolve base constraint to reveal circularity errors
80025 getBaseConstraintOfType(typeParameter);
80026 if (!hasNonCircularTypeParameterDefault(typeParameter)) {
80027 error(node.default, ts.Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter));
80028 }
80029 var constraintType = getConstraintOfTypeParameter(typeParameter);
80030 var defaultType = getDefaultFromTypeParameter(typeParameter);
80031 if (constraintType && defaultType) {
80032 checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
80033 }
80034 checkNodeDeferred(node);
80035 addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
80036 }
80037 function checkTypeParameterDeferred(node) {
80038 if (ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent)) {
80039 var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));

Callers 2

checkTypeParametersFunction · 0.85
checkSourceElementWorkerFunction · 0.85

Calls 15

checkGrammarModifiersFunction · 0.85
grammarErrorOnFirstTokenFunction · 0.85
checkSourceElementFunction · 0.85
getSymbolOfNodeFunction · 0.85
getBaseConstraintOfTypeFunction · 0.85
typeToStringFunction · 0.85
checkTypeAssignableToFunction · 0.85
getTypeWithThisArgumentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…