You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was just wondering why does the keys function not work with dynamic names passed to it?
Is this because of an inherent TypeScript limitation or is it a transformation function limitation?
For reference, this is what my code roughly looks like right now but does not seem to work const instances = ['a','b','c']; for(let instance of instances){ let instanceKeys = keys<NexusPrismaTypes[instance]>(); console.log(instanceKeys) //Returns an empty array }
The text was updated successfully, but these errors were encountered:
constinstances=['a','b','c'];for(letinstanceofinstances){// add typeof in front of instanceletinstanceKeys=keys<NexusPrismaTypes[typeofinstance]>();console.log(instanceKeys);}
// add 'as const'constinstances=['a','b','c']asconst;for(letinstanceofinstances){// add typeof in front of instanceletinstanceKeys=keys<NexusPrismaTypes[typeofinstance]>();console.log(instanceKeys);}
Hello,
I was just wondering why does the keys function not work with dynamic names passed to it?
Is this because of an inherent TypeScript limitation or is it a transformation function limitation?
For reference, this is what my code roughly looks like right now but does not seem to work
const instances = ['a','b','c'];
for(let instance of instances){
let instanceKeys = keys<NexusPrismaTypes[instance]>();
console.log(instanceKeys) //Returns an empty array
}
The text was updated successfully, but these errors were encountered: