New feature: TypeScript Svelte Apollo
See original GitHub issueThere is currently no support for Svelte, I propose a plugin to create a Svelte context to handle the ApolloClient that supports TypeScript. There is nothing complicated at this point, with only two possible parameters:
loadGetClientFrom
takesgetClient
from the file pointed to for use with the ApolloClientexportOnlyFunctions
remove exports for graphql documents, data types, input & output formats ; the generated file exportsgetClient
,setClient
, query, mutation & subscription functions.
I propose a PR in 3 commits:
- Adding the plugin
- Add the plugin to the global configuration
- Add the plugin in the website
Edit: just pushed a complement for documentations. Hope you enjoy it !
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
typescript-svelte-apollo - GraphQL Code Generator
This plugin generates observable Apollo queries with Typescript typings. This is a community plugin, to report eventual issues or find more ...
Read more >graphql-codegen-typescript-svelte-apollo - npm package - Snyk
GraphQL Code Generator plugin for generating ready-to-use Svelte-Apollo composition functions based on GraphQL operations For more information about how to ...
Read more >graphql-codegen + typescript-svelte-apollo - Refetch not ...
(Edited) Refetching with the generated query type seems to work different from the refetch function in Apollo Client useQuery .
Read more >svelte-apollo - npm
Latest version: 0.5.0, last published: 6 months ago. Start using svelte-apollo in your project by running `npm i svelte-apollo`.
Read more >How to Setup Svelte with GraphQL, TypeScript and Material-UI?
Svelte is a Component Framework like React and Vue, that aims to compile ... new ApolloClient({ uri: 'http://localhost:8080/v1/graphql', ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
By reading the pull request, everything is pretty much the same, except you’re not using watchQueries (they work really well with svelte reactivity). You are using svelte context to bring the Apollo client, I’m not sure if this is really needed, you will run into problems when using this plugin with sapper/svelte-kit with SSR activated. It’s also why you need svelte as a dependency to your plugin.
@karkael64 closing for now as we haven’t heard back from you after @ticruz38 recent comment. If this still doesn’t solve your problem please feel free to comment here and reopen the issue and PR.
Also, regarding that, I wonder what Svelte developers think about the new
near-operation-file-preset
introduced in Codegen V2? Would be great to hear your feedback about that.Thanks!