我想将其创建为最终结果:{"customerName: {"contains": "bri"}}
,但我一直在写变量的名称。我已经尝试了很多事情,但无法让它如我所愿。希望这很简单,我只是完全忽略了它。
interface IGraphQLFilterVariable {
[key: string]: [key: string] | any | IGraphQLFilterVariable[]
}
let property = "customerName";
let type = "contains";
let filter = "bri";
let singleFilter: IGraphQLFilterVariable = {};
singleFilter[property] = {
type: filter
};
console.log(singleFilter);