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

Method add

internal/checker/checker.go:23338–23350  ·  view source on GitHub ↗
(t *Type, info TupleElementInfo)

Source from the content-addressed store, hash-verified

23336}
23337
23338func (n *TupleNormalizer) add(t *Type, info TupleElementInfo) {
23339 if info.flags&ElementFlagsRequired != 0 {
23340 n.lastRequiredIndex = len(n.types)
23341 }
23342 if info.flags&ElementFlagsRest != 0 && n.firstRestIndex < 0 {
23343 n.firstRestIndex = len(n.types)
23344 }
23345 if info.flags&(ElementFlagsOptional|ElementFlagsRest) != 0 {
23346 n.lastOptionalOrRestIndex = len(n.types)
23347 }
23348 n.types = append(n.types, n.c.addOptionalityEx(t, true /*isProperty*/, info.flags&ElementFlagsOptional != 0))
23349 n.infos = append(n.infos, info)
23350}
23351
23352// Return count of starting consecutive tuple elements of the given kind(s)
23353func getStartElementCount(t *TupleType, flags ElementFlags) int {

Callers 1

normalizeMethod · 0.95

Calls 3

lenFunction · 0.85
addOptionalityExMethod · 0.80
appendFunction · 0.50

Tested by

no test coverage detected