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

Function arrayIsHomogeneous

internal/checker/nodebuilderimpl.go:455–467  ·  view source on GitHub ↗
(array []T, comparer func(a, B T) bool)

Source from the content-addressed store, hash-verified

453}
454
455func arrayIsHomogeneous[T any](array []T, comparer func(a, B T) bool) bool {
456 if len(array) < 2 {
457 return true
458 }
459 first := array[0]
460 for i := 1; i < len(array); i++ {
461 target := array[i]
462 if !comparer(first, target) {
463 return false
464 }
465 }
466 return true
467}
468
469func typesAreSameReference(a, b *Type) bool {
470 return a == b || a.symbol != nil && a.symbol == b.symbol || a.alias != nil && a.alias == b.alias

Callers 1

mapToTypeNodesMethod · 0.85

Calls 1

lenFunction · 0.85

Tested by

no test coverage detected