query icon indicating copy to clipboard operation
query copied to clipboard

Support TS `moduleResolution: node16` in `svelte-query`

Open giacomoran opened this issue 1 year ago • 0 comments

Describe the bug

In TS, @tanstack/svelte-query imports are broken under moduleResolution: nodenext (currently equivalent to moduleResolution: node16). See https://arethetypeswrong.github.io/?p=@tanstack/[email protected]

This happens because imports/exports in dist are missing the file extensions, e.g. export { createQuery } from './createQuery' instead of export { createQuery } from './createQuery.js'.

Your minimal, reproducible example

codesandbox

Steps to reproduce

I forked the "Simple" Svelte example.

Hover type InspectMe = typeof createQuery in src/test.ts, the type appears as any under moduleResolution: nodenext.

Expected behavior

InspectMe type should be resolved correctly.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

NA

Tanstack Query adapter

None

TanStack Query version

5.37.1

TypeScript version

5.3.3

Additional context

We use moduleResolution: nodenext for our SvelteKit project because we have shared modules that are executed with Node.js. moduleResolution: nodenext is the strictest moduleResolution option, it ensures that both node and browsers understand our modules.

giacomoran avatar May 20 '24 16:05 giacomoran