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

Method getTupleTargetType

internal/checker/checker.go:24659–24674  ·  view source on GitHub ↗
(elementInfos []TupleElementInfo, readonly bool)

Source from the content-addressed store, hash-verified

24657}
24658
24659func (c *Checker) getTupleTargetType(elementInfos []TupleElementInfo, readonly bool) *Type {
24660 if len(elementInfos) == 1 && elementInfos[0].flags&ElementFlagsRest != 0 {
24661 // [...X[]] is equivalent to just X[]
24662 if readonly {
24663 return c.globalReadonlyArrayType
24664 }
24665 return c.globalArrayType
24666 }
24667 key := getTupleKey(elementInfos, readonly)
24668 t := c.tupleTypes[key]
24669 if t == nil {
24670 t = c.createTupleTargetType(elementInfos, readonly)
24671 c.tupleTypes[key] = t
24672 }
24673 return t
24674}
24675
24676// We represent tuple types as type references to synthesized generic interface types created by
24677// this function. The types are of the form:

Callers 3

createTupleTypeExMethod · 0.95

Calls 3

createTupleTargetTypeMethod · 0.95
lenFunction · 0.85
getTupleKeyFunction · 0.85

Tested by

no test coverage detected