I want to implement a pick option combined with some key remapping. Something like this:
let demo: {
one$: number
two$: string
}
let result = pick(demo, ['one'])
// result equals { one: number }
So basically I want to pick the object keys without the $ suffix.
By basic pick without key remap is this:
function pick<T, K extends keyof T>(x: T, keys: K[]): Pick<T, K> {
// ...
}
And I can add the suffix with this:
type WithStreamSuffix<T> = { [P in keyof T & string as `${P}$`]: T[P] }
But I have not managed to mix both. Probably it would be easier using a key remap that drops the suffix, but I do not know how.