I am trying to created a custom type that replaces all types of a Generic parameter T to string[] but keeps all the property names even nested.
Expected behaviour: No error
interface Bar {
lat: string,
lng: string
}
interface Foo {
id: string,
bar: Bar
}
export type PartialDeepKeyOf<T> = { [id in keyof T]: string[] }
const baz: PartialDeepKeyOf<Foo> = {
id: ['a','b'],
bar: {
lat: ['a','b'],
lng: ['a','b'],
}
}
Actual behaviour:
Type '{ lat: string[]; lng: string[]; }' is not assignable to type 'string[]'