Open
Description
π Search Terms
Extract, type union
π Version & Regression Information
- This changed between versions 5.33 and 5.4
β― Playground Link
π» Code
type StringKeys<T> = Extract<keyof {
[P in keyof T as T[P] extends string ? P: never]: any
}, string>
const bloop = <T,>(z: StringKeys<T>) => {
const f: string = z
}
interface asd {
qwe: string
}
let a: StringKeys<asd>
π Actual behavior
z
is not assignable to string
in the bloop
function
π Expected behavior
z
should be assignable to string
, because we extract string-extending keys
Additional information about the issue
This was working just fine on 5.3.3, and continues to work when the generic is concretized (hence the let
at the bottom of the example)