(node *ast.Node)
| 4972 | } |
| 4973 | |
| 4974 | func (c *Checker) checkInterfaceDeclaration(node *ast.Node) { |
| 4975 | if !c.checkGrammarModifiers(node) { |
| 4976 | c.checkGrammarInterfaceDeclaration(node.AsInterfaceDeclaration()) |
| 4977 | } |
| 4978 | if !c.containerAllowsBlockScopedVariable(node.Parent) { |
| 4979 | c.grammarErrorOnNode(node, diagnostics.X_0_declarations_can_only_be_declared_inside_a_block, "interface") |
| 4980 | } |
| 4981 | c.checkTypeParameters(node.TypeParameters()) |
| 4982 | c.checkTypeNameIsReserved(node.Name(), diagnostics.Interface_name_cannot_be_0) |
| 4983 | c.checkExportsOnMergedDeclarations(node) |
| 4984 | symbol := c.getSymbolOfDeclaration(node) |
| 4985 | c.checkTypeParameterListsIdentical(symbol) |
| 4986 | // Only check this symbol once |
| 4987 | if links := c.declaredTypeLinks.Get(symbol); !links.interfaceChecked { |
| 4988 | links.interfaceChecked = true |
| 4989 | t := c.getDeclaredTypeOfSymbol(symbol) |
| 4990 | typeWithThis := c.getTypeWithThisArgument(t, nil, false) |
| 4991 | // run subsequent checks only if first set succeeded |
| 4992 | if c.checkInheritedPropertiesAreIdentical(t, node.Name()) { |
| 4993 | for _, baseType := range c.getBaseTypes(t) { |
| 4994 | c.checkTypeAssignableTo(typeWithThis, c.getTypeWithThisArgument(baseType, t.AsInterfaceType().thisType, false), node.Name(), diagnostics.Interface_0_incorrectly_extends_interface_1) |
| 4995 | } |
| 4996 | c.checkIndexConstraints(t, symbol /*isStaticIndex*/, false) |
| 4997 | } |
| 4998 | } |
| 4999 | c.checkObjectTypeForDuplicateDeclarations(node, false /*checkPrivateNames*/) |
| 5000 | for _, heritageElement := range ast.GetExtendsHeritageClauseElements(node) { |
| 5001 | expr := heritageElement.Expression() |
| 5002 | if !ast.IsEntityNameExpression(expr) || ast.IsOptionalChain(expr) { |
| 5003 | c.error(expr, diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments) |
| 5004 | } |
| 5005 | c.checkTypeReferenceNode(heritageElement) |
| 5006 | } |
| 5007 | c.checkSourceElements(node.Members()) |
| 5008 | c.checkClassOrInterfaceForDuplicateIndexSignatures(node) |
| 5009 | c.registerForUnusedIdentifiersCheck(node) |
| 5010 | } |
| 5011 | |
| 5012 | type InheritanceInfo struct { |
| 5013 | prop *ast.Symbol |
no test coverage detected