Skip to content

Commit f0f9fef

Browse files
Copilotjakebailey
andcommitted
Simplify findPropertyInType using IsUnion() and Types() methods
Co-authored-by: jakebailey <[email protected]>
1 parent ff34e99 commit f0f9fef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/ls/hover.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,8 @@ func writeQuotedString(b *strings.Builder, str string, quote bool) {
606606
// findPropertyInType finds a property in a type, handling union types by searching constituent types
607607
func findPropertyInType(c *checker.Checker, objectType *checker.Type, propertyName string) *ast.Symbol {
608608
// For union types, try to find the property in any of the constituent types
609-
if objectType.Flags()&checker.TypeFlagsUnion != 0 {
610-
for _, t := range objectType.AsUnionType().Types() {
609+
if objectType.IsUnion() {
610+
for _, t := range objectType.Types() {
611611
if prop := c.GetPropertyOfType(t, propertyName); prop != nil {
612612
return prop
613613
}

0 commit comments

Comments
 (0)