We consider a type to be partially inferable if it isn't marked non-inferable or if it is an object literal type with at least one property of an inferable type. For example, an object literal { a: 123, b: x => true } is marked non-inferable because it contains a context sensitive arrow function, bu
(t *Type)
| 1024 | // literal { a: 123, b: x => true } is marked non-inferable because it contains a context sensitive |
| 1025 | // arrow function, but is considered partially inferable because property 'a' has an inferable type. |
| 1026 | func (c *Checker) isPartiallyInferableType(t *Type) bool { |
| 1027 | return t.objectFlags&ObjectFlagsNonInferrableType == 0 || isObjectLiteralType(t) && core.Some(c.getPropertiesOfType(t), func(prop *ast.Symbol) bool { |
| 1028 | return c.isPartiallyInferableType(c.getTypeOfSymbol(prop)) |
| 1029 | }) || isTupleType(t) && core.Some(c.getElementTypes(t), c.isPartiallyInferableType) |
| 1030 | } |
| 1031 | |
| 1032 | func (c *Checker) inferReverseMappedType(source *Type, target *Type, constraint *Type) *Type { |
| 1033 | key := ReverseMappedTypeKey{sourceId: source.id, targetId: target.id, constraintId: constraint.id} |
no test coverage detected