15fae38b39
* Narrow type variables with union constraints when merited by contextual type * Narrow generics with union type constraints as indicated by contextual type * Accept new baselines * Add tests * Fix circularity for JSX elements * Remove unnecessary isConstraintPosition information from flow cache key * Update comment * Add additional tests * Rename to getNarrowableTypeForReference, remove getConstraintForLocation * Add comment * Fix removal of undefined in destructurings with initializers * Use getContextFreeTypeOfExpression in discriminateContextualTypeByObjectMembers * In obj[x], use constraint of obj's type only when x's type is non-generic * Add comment
14 lines
382 B
Plaintext
14 lines
382 B
Plaintext
=== tests/cases/compiler/nonNullMappedType.ts ===
|
|
function f<A extends string>(p0: { [key in A]: {} | undefined }, p1: A) {
|
|
>f : <A extends string>(p0: { [key in A]: {} | undefined; }, p1: A) => void
|
|
>p0 : { [key in A]: {} | undefined; }
|
|
>p1 : A
|
|
|
|
const v: {} = p0[p1]!;
|
|
>v : {}
|
|
>p0[p1]! : {}
|
|
>p0[p1] : {} | undefined
|
|
>p0 : { [key in A]: {} | undefined; }
|
|
>p1 : A
|
|
}
|