MCPcopy Create free account
hub / github.com/Effect-TS/tsgo / checkOutdatedApiPropertyAccess

Function checkOutdatedApiPropertyAccess

internal/rules/outdated_api.go:95–150  ·  view source on GitHub ↗
(tp *typeparser.TypeParser, c *checker.Checker, sf *ast.SourceFile, n *ast.Node)

Source from the content-addressed store, hash-verified

93}
94
95func checkOutdatedApiPropertyAccess(tp *typeparser.TypeParser, c *checker.Checker, sf *ast.SourceFile, n *ast.Node) *OutdatedApiMatch {
96 prop := n.AsPropertyAccessExpression()
97 if prop == nil {
98 return nil
99 }
100
101 nameNode := prop.Name()
102 if nameNode == nil {
103 return nil
104 }
105
106 identifierName := nameNode.Text()
107 if identifierName == "" {
108 return nil
109 }
110
111 migration, ok := EffectModuleMigrationDb[identifierName]
112 if !ok {
113 return nil
114 }
115
116 // Skip unchanged entries — they exist in both v3 and v4
117 if migration.Tag == MigrationTagUnchanged {
118 return nil
119 }
120
121 // Get the type of the expression (left side of the property access)
122 expr := prop.Expression
123 if expr == nil {
124 return nil
125 }
126
127 targetType := tp.GetTypeAtLocation(expr)
128 if targetType == nil {
129 return nil
130 }
131
132 // Only report if the property does NOT exist on the target type
133 // (confirming it's a v3-only API)
134 if c.GetPropertyOfType(targetType, identifierName) != nil {
135 return nil
136 }
137
138 // Verify the expression references the Effect module
139 if !tp.IsExpressionEffectModule(expr) {
140 return nil
141 }
142
143 return &OutdatedApiMatch{
144 SourceFile: sf,
145 Location: scanner.GetErrorRangeForNode(sf, nameNode),
146 PropertyName: identifierName,
147 MigrationHint: migrationHintText(migration),
148 Migration: migration,
149 }
150}
151
152func migrationHintText(m Migration) string {

Callers 1

AnalyzeOutdatedApiFunction · 0.85

Calls 3

migrationHintTextFunction · 0.85
GetTypeAtLocationMethod · 0.45

Tested by

no test coverage detected