vishalbalaji / trpc-svelte-query-adapter

A simple adapter to use `@tanstack/svelte-query` with trpc, similar to `@trpc/react-query`.
71 stars 6 forks source link

The `trpc: { abortOnUnmount: boolean }` type is now (unintentionally?) required on every query #19

Closed fnimick closed 8 months ago

fnimick commented 8 months ago

This happens due to TRPCQueryOpts now being required on createQuery: https://github.com/vishalbalaji/trpc-svelte-query-adapter/blob/481aa9bb894542980c4101a0dbbeb71295f7b111/src/index.ts#L207

Based on my cursor read, this isn't required since all lookups are of opts?.trpc?.abortOnUnmount - implying that null values are valid here. Should the type be changed?

vishalbalaji commented 8 months ago

You are absolutely right, both trpc and abortOnUnmount should be optional. Thanks a lot for pointing this out!