I have a function like the following
getModuleMeasures(
modules: Pick<Module, "id">[]
){
return this.store$.select(getModuleMeasures(modules));
}
I don't know what type of value that needs to be passed as an argument.
I tried passing the module id's as the parameter but it is not accepting. when i try to pass the id as string throws Type 'string' is not assignable to type 'Pick<Module, "id">'. error.
CodePudding user response:
The parameter needs to be an array of objects, which will have one key, id
. The type of the value of id
will be whatever it is in Module
type Module = {
id: string,
abc: number
}
function getModuleMeasures(modules: Pick<Module, "id">[]) {
console.log(modules)
}
getModuleMeasures([{id:'123'}])