MCPcopy Create free account
hub / github.com/microsoft/typescript-go / errorIfWritingToReadonlyIndex

Method errorIfWritingToReadonlyIndex

internal/checker/checker.go:27135–27139  ·  view source on GitHub ↗
(indexInfo *IndexInfo, objectType *Type, accessExpression *ast.Node)

Source from the content-addressed store, hash-verified

27133}
27134
27135func (c *Checker) errorIfWritingToReadonlyIndex(indexInfo *IndexInfo, objectType *Type, accessExpression *ast.Node) {
27136 if indexInfo != nil && indexInfo.isReadonly && accessExpression != nil && (ast.IsAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression)) {
27137 c.error(accessExpression, diagnostics.Index_signature_in_type_0_only_permits_reading, c.TypeToString(objectType))
27138 }
27139}
27140
27141func (c *Checker) isSelfTypeAccess(name *ast.Node, parent *ast.Symbol) bool {
27142 return name.Kind == ast.KindThisKeyword || parent != nil && ast.IsEntityNameExpression(name) && parent == c.getResolvedSymbol(ast.GetFirstIdentifier(name))

Callers 1

Calls 4

errorMethod · 0.95
TypeToStringMethod · 0.95
IsAssignmentTargetFunction · 0.92
isDeleteTargetFunction · 0.85

Tested by

no test coverage detected