-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat(core): Leverage gql.tada
for typings
#119
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
778e40e
to
9f88d7a
Compare
4031799
to
e9ee558
Compare
e9ee558
to
3120259
Compare
packages/core/src/cli.ts
Outdated
@@ -91,6 +91,7 @@ prog | |||
} | |||
|
|||
if (opts.client) { | |||
// TODO: bail out when the user is using gql.tada |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking here is basically that we can check whether
- We have a valid
gql.tada
installation - We have the config set in the
tsconfig
If the above don't hold up we need to codegen to support users with prior generated code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is beautiful for this migration for any early users we have. I'd love to be able to remove codegen entirely in v1.0!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is AWESOME!!!
}) => { | ||
const result = useFragment(SiteLocationFields, props.location) | ||
const result = readFragment(SiteLocationFields, props.location) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:chef-kiss:
@@ -10,9 +10,9 @@ const SiteLocationFields = graphql(` | |||
`) | |||
|
|||
export const Location = (props: { | |||
location: FragmentType<typeof SiteLocationFields> | |||
location: FragmentOf<typeof SiteLocationFields> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:chef-kiss:
path.resolve(base, 'fuse/index.ts'), | ||
`// This is a generated file!\n\nexport * from './tada';\nexport * from 'fuse/client';\n`, | ||
), | ||
fs.writeFile(path.resolve(base, 'fuse/tada.ts'), tadaGqlContents), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future when folks use custom scalars, ... we might not want to override this
}>() | ||
|
||
export type { FragmentOf, ResultOf, VariablesOf } from 'gql.tada' | ||
export type { FragmentOf as FragmentType } from 'gql.tada' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some aliases for backwards compat and docs clarity
The issue I am having here conceptually is that folks need
graphqlsp
to work correctly so that theintrospection.ts
file gets outputted correctly. Currently thinking whether we can establish a few safeguards here.The goal here is for new users to gain access to
gql.tada
while former users don't have to change up their code and can stick to the LSP.I have updated the documentation with both a migrating to and disabling chunk.
Resolves #70