How do you define a paradigm type to return all attribute names that implement a specific type in the original type?

type KeyOfByType<T extends object, P> = ???

type T1 = {
    a: string
    b: number
    c: string
    d: object
}
type T2 = KeyOfByType<T1, string>
// type T2 = "a" | "c"

how do you define KeyOfByType above?

Jul.11,2022

type NoneStringKeys<T, K> = {
  [P in keyof T]: T[P] extends K ? never : P;
}[keyof T];

type KeyOfByType<T, K> = keyof Pick<T, Exclude<keyof T, NoneStringKeys<T, K>>>;

interface T1 {
    a: string
    b: number
    c: string
    d: object
}

type T2 = KeyOfByType<T1, string>;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3053d-2bcf8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3053d-2bcf8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?