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

Function checkInterfaceDeclaration

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

Source from the content-addressed store, hash-verified

84619 return !(getFalsyFlags(flowType) & 32768 /* TypeFlags.Undefined */);
84620 }
84621 function checkInterfaceDeclaration(node) {
84622 // Grammar checking
84623 if (!checkGrammarDecoratorsAndModifiers(node))
84624 checkGrammarInterfaceDeclaration(node);
84625 checkTypeParameters(node.typeParameters);
84626 addLazyDiagnostic(function () {
84627 checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0);
84628 checkExportsOnMergedDeclarations(node);
84629 var symbol = getSymbolOfNode(node);
84630 checkTypeParameterListsIdentical(symbol);
84631 // Only check this symbol once
84632 var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */);
84633 if (node === firstInterfaceDecl) {
84634 var type = getDeclaredTypeOfSymbol(symbol);
84635 var typeWithThis = getTypeWithThisArgument(type);
84636 // run subsequent checks only if first set succeeded
84637 if (checkInheritedPropertiesAreIdentical(type, node.name)) {
84638 for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) {
84639 var baseType = _a[_i];
84640 checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1);
84641 }
84642 checkIndexConstraints(type, symbol);
84643 }
84644 }
84645 checkObjectTypeForDuplicateDeclarations(node);
84646 });
84647 ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) {
84648 if (!ts.isEntityNameExpression(heritageElement.expression) || ts.isOptionalChain(heritageElement.expression)) {
84649 error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
84650 }
84651 checkTypeReferenceNode(heritageElement);
84652 });
84653 ts.forEach(node.members, checkSourceElement);
84654 addLazyDiagnostic(function () {
84655 checkTypeForDuplicateIndexSignatures(node);
84656 registerForUnusedIdentifiersCheck(node);
84657 });
84658 }
84659 function checkTypeAliasDeclaration(node) {
84660 // Grammar checking
84661 checkGrammarDecoratorsAndModifiers(node);

Callers 1

checkSourceElementWorkerFunction · 0.85

Calls 15

checkTypeParametersFunction · 0.85
addLazyDiagnosticFunction · 0.85
checkTypeNameIsReservedFunction · 0.85
getSymbolOfNodeFunction · 0.85
getDeclaredTypeOfSymbolFunction · 0.85
getTypeWithThisArgumentFunction · 0.85
getBaseTypesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…