@tanstack/svelte-devtools: published declarations omit .js extension on ./types imports, breaking node16/nodenext
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 85/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- developer-experience, tooling
Direção de pesquisa
Leia os três pontos de entrada do código-fonte mencionados na issue: packages/svelte-devtools/src/index.ts, TanStackDevtools.svelte e devtools.ts. Atualize as importações relativas de ./types conforme descrito, depois compile o pacote e verifique as declarações com a resolução NodeNext ou Node16 e skipLibCheck desativado; o trabalho estará concluído quando as declarações forem resolvidas e os erros TS2835 relatados desaparecerem.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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(andTanStackDevtools.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/
- Linguagem predominante
- TypeScript
- Estrelas
- 514
- Forks
- 105
- Merge médio
- 11h 38min
- PRs com merge (30d)
- 2
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TanStack/devtools
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
-
devtools-vite: four transform hooks have no filter, and inject-plugin parses pre-bundled dependency chunksTalvez já em andamento @shkumbinhasani assumiu há 30 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 38/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 52/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
Todas as issues de TanStack/devtools
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
vercel-labs/ui#809 ·
Mantenedores costumam responder em até 1 dia
-
bot:ai-assisted component:platform-js status:untriaged
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 74/100
midnightntwrk/platform-js#38 ·
-
[bug] Second false positive on high-cost plugin alert: detection only compares patch entry id, community plugin dsh-auto | [bug] 高成本插件告警第二次误报:检测只比对 patch 条目 id,社区插件 dsh-auto-review 被认成 @deepseek-ai/dsh-experimental-auto-reviewTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
ranxianglei/billion-context#7068 ·
Mantenedores costumam responder em até 1 dia
-
vendor: bump whisper.cpp past 6a8addd — the current pin aborts the app on a failed Metal initAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
mybigday/whisper.rn#348 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
six-group/six-webcomponents#600 ·