@tanstack/svelte-devtools: published declarations omit .js extension on ./types imports, breaking node16/nodenext

Ouverte Adaptée aux débutants
#564 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

@dirgaydtm y travaille déjà.

Depuis le 17/11/2026.

  • #565 par @dirgaydtm — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
85/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
typescript

Piste de recherche

Lis les trois points d’entrée du code source mentionnés dans l’issue : packages/svelte-devtools/src/index.ts, TanStackDevtools.svelte et devtools.ts. Mets à jour leurs imports relatifs de ./types comme indiqué, puis compile le package et vérifie les déclarations avec la résolution NodeNext ou Node16 et skipLibCheck désactivé ; le travail est terminé lorsque les déclarations sont résolues et que les erreurs TS2835 signalées ont disparu.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

TanStack Devtools version

@tanstack/[email protected] (also main at 8f62544)

Framework/Library version

[email protected], [email protected], [email protected] and [email protected]

Describe the bug and the steps to reproduce it

@tanstack/svelte-devtools sets "type": "module" and builds with svelte-package, which preserves relative import specifiers verbatim in dist/esm/. Three files import ./types without a .js extension:

  • dist/esm/index.d.ts: export type { TanStackDevtoolsSveltePlugin, TanStackDevtoolsSvelteInit, } from './types';
  • dist/esm/TanStackDevtools.svelte.d.ts (and TanStackDevtools.svelte): import type { TanStackDevtoolsSvelteInit } from './types';
  • dist/esm/devtools.d.ts: import type { TanStackDevtoolsSvelteInit } from './types';

Under moduleResolution: "NodeNext" or "Node16" (which SvelteKit's packaging docs recommend for Svelte libraries), TypeScript requires explicit .js extensions on relative imports in ESM declarations. With skipLibCheck: true, ./types fails to resolve and both <TanStackDevtools /> props and the exported TanStackDevtoolsSveltePlugin / TanStackDevtoolsSvelteInit types silently degrade to any. With skipLibCheck: false, svelte-check and tsc fail with TS2835.

Steps to reproduce:

npm init -y
npm i @tanstack/[email protected] [email protected] [email protected] [email protected]
<!-- src/App.svelte -->
<script lang="ts">
  import {
    TanStackDevtools,
    type TanStackDevtoolsSveltePlugin,
  } from "@tanstack/svelte-devtools";

  const badPlugin: TanStackDevtoolsSveltePlugin = 123;
</script>

<TanStackDevtools config={{ openHotkey: 123 }} plugins={[badPlugin]} />
{
  "compilerOptions": {
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "target": "ES2022",
    "strict": true,
    "skipLibCheck": true,
    "types": ["svelte"]
  },
  "include": ["src/**/*"]
}

Running npx svelte-check --tsconfig ./tsconfig.json reports:

svelte-check found 0 errors and 0 warnings

With "skipLibCheck": false, npx svelte-check --tsconfig ./tsconfig.json fails inside @tanstack/svelte-devtools (and tsc --noEmit --module nodenext --moduleResolution nodenext --skipLibCheck false reports the same TS2835 on index.d.ts under TypeScript 6.0.3 and 7.0.2):

node_modules/@tanstack/svelte-devtools/dist/esm/TanStackDevtools.svelte.d.ts:1:49
Error: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './types.js'? 
import type { TanStackDevtoolsSvelteInit } from './types';
declare const TanStackDevtools: import("svelte").Component<TanStackDevtoolsSvelteInit, {}, "">;

node_modules/@tanstack/svelte-devtools/dist/esm/index.d.ts:2:80
Error: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './types.js'? 
export { default as TanStackDevtools } from './TanStackDevtools.svelte';
export type { TanStackDevtoolsSveltePlugin, TanStackDevtoolsSvelteInit, } from './types';

Expected output (matching "module": "ESNext", "moduleResolution": "Bundler"):

src/App.svelte:7:9
Error: Type 'number' is not assignable to type 'TanStackDevtoolsSveltePlugin'. (ts)

src/App.svelte:10:29
Error: Type 'number' is not assignable to type 'KeyboardKey[]'. (ts)

svelte-check found 2 errors and 0 warnings in 1 file

Changing from './types' to from './types.js' in packages/svelte-devtools/src/index.ts, packages/svelte-devtools/src/TanStackDevtools.svelte (which already uses from './devtools.js' on the line above), and packages/svelte-devtools/src/devtools.ts resolves this.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://gist.github.com/trackoor/e88698351ce89d44b8cf5c516d8e7871

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

No, because I do not have time to dig into it

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Credit: https://ucsbplse.github.io/

Langage dominant
TypeScript
Étoiles
514
Forks
105
Merge moyen
11 h 38 min
PR mergées (30 j)
2

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de TanStack/devtools

Toutes les issues de TanStack/devtools

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.