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

Method newBackreferenceMapper

internal/checker/mapper.go:77–83  ·  view source on GitHub ↗

Maps forward-references to later types parameters to the empty object type. This is used during inference when instantiating type parameter defaults.

(context *InferenceContext, index int)

Source from the content-addressed store, hash-verified

75// Maps forward-references to later types parameters to the empty object type.
76// This is used during inference when instantiating type parameter defaults.
77func (c *Checker) newBackreferenceMapper(context *InferenceContext, index int) *TypeMapper {
78 forwardInferences := context.inferences[index:]
79 typeParameters := core.Map(forwardInferences, func(i *InferenceInfo) *Type {
80 return i.typeParameter
81 })
82 return newArrayToSingleTypeMapper(typeParameters, c.unknownType)
83}
84
85// TypeMapperBase
86

Callers 1

getInferredTypeMethod · 0.95

Calls 2

MapFunction · 0.92

Tested by

no test coverage detected