// Note the "any", which should be the type I'm missing.
type SelectionMap<T extends ProductSelect> = {
[K in keyof T]: T[K] extends true ? { [key: string]: any } : {};
};
export namespace ProductSearchService {
function getSelect<T extends ProductSelect>(select: T): SelectionMap<T> {
return {
...(select.test
? {
testA: {
id: testTable.id,
name: testTable.name,
},
testB: {
id: testTable2.id,
name: testTable2.name,
},
}
: {}),
// Note the "any", which should be the type I'm missing.
type SelectionMap<T extends ProductSelect> = {
[K in keyof T]: T[K] extends true ? { [key: string]: any } : {};
};
export namespace ProductSearchService {
function getSelect<T extends ProductSelect>(select: T): SelectionMap<T> {
return {
...(select.test
? {
testA: {
id: testTable.id,
name: testTable.name,
},
testB: {
id: testTable2.id,
name: testTable2.name,
},
}
: {}),