New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: dynamic output property #205
Conversation
This is close, but not quite the change we want - we want the ability to define both dynamic input methods & properties. I know what the issue is here, ran into it when adding tests for #200 - will open a little later this morning. |
Sounds good, but isn't that possible now, just depending on what const block: any = {}
Object.defineProperty(block, "foo", {
get: () => {
return (): string => {
return "bar"
}
},
})
Object.defineProperty(block, "nested", {
get: () => {
return {
foo: (): string => {
return "bar"
},
}
},
})
console.log(block.foo()) // bar
console.log(block.nested.foo()) // bar ? |
This PR originally added If we want to keep them as distinct concepts, I believe what's left is:
https://github.com/prisma/nexus/pull/200/files#diff-84231b52da5756993249faf30a25c7c3R34 I had also written some tests for the "dynamic" method/property pieces on that plugin branch that might be useful to port over: https://github.com/prisma/nexus/pull/200/files#diff-ce313718055422103750b425fdbcb1c2R1 Let me know what you think of this approach / if this clears up what I meant by ^. |
This comment has been minimized.
This comment has been minimized.
Hey @tgriesser, you can ignore my previous comment. I started work on adding
This PR is now focused on point 2 above. Via package link on local I was able to get tests passing on |
I tried pulling in some of the tests from #200 but they were non-trivial as they depended upon numerous other additions in that PR not present here. Therefore stopping trying to port any over here now. On account of this PR being now only additive and rather simple and clear, I am going to move ahead with it. |
This change addresses the last thing remaining in the way before
nexus-prisma
can get back on the nexus mainline.graphql-nexus/nexus-prisma#304