Skip to content

Support TS moduleResolution: node16 in svelte-query #7463

@giacomoran

Description

@giacomoran

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/svelte-query@5.37.1

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions