Task description:
Assume you have the following files:
query1.ts
type Args = {
arg1: number,
arg2: string
}
type ReturnVal = {
value: string
}
function getStringData(args: Args): ReturnVal {
return { value: "Returned" }
}
query2.ts
type Args = {
arg1: string,
arg2: number
}
type ReturnVal = {
value: boolean
}
function getBooleanData(args: Args): ReturnVal {
return { value: true }
}
Also assume there could be more queryX.ts
files similar to this.
Implement a TS class (let's call it Querier
) that can be configured with 1 or more of those queries in such a way where:
const results = querier.query1.getStringData(args);
and/or
const results = querier.query2.getBooleanData(args);
etc.
are available, typed appropriately and with code-completion working.
You are free to make any appropriate modifications to the query files.
Bonus:
Make output of the queryX
functions vary based on a configuration variable of the querier.