Skip to content
Source
Sign inSign up
TanStack/router

Regression: generated d.ts files for ESM don’t have file extensions #2190

Send to my agent
Closedlo1tuma(GitHub profile, opens in a new tab) opened this issue 4 comments

Describe the bug

The bug reported in #1087 appears again with the latest version 1.50.1 for @tanstack/react-router as well as @tanstack/start

react-router:

node_modules/@tanstack/react-router/dist/esm/fileRoute.d.ts:54:31 - error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './useNavigate.js'?

54     useNavigate: () => import('./useNavigate').UseNavigateResult<string>;
                                 ~~~~~~~~~~~~~~~

node_modules/@tanstack/react-router/dist/esm/index.d.ts:58:118 - error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './utils.js'?

58 pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils';
                                                                                                                        ~~~~~~~~~

node_modules/@tanstack/react-router/dist/esm/link.d.ts:1:43 - error TS2307: Cannot find module '.' or its corresponding type declarations.

1 import { AnyRouter, ParsedLocation } from '.';

start:

node_modules/@tanstack/start/dist/esm/client/index.d.ts:8:70 - error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../constants.js'?

8 export { serverFnPayloadTypeHeader, serverFnReturnTypeHeader, } from '../constants';

Your Example Website or App

https://stackblitz.com/edit/github-yk78pg-anfycf?file=README.md

Steps to Reproduce the Bug or Issue

  1. set moduleResolution in tsconfig set to node16
  2. import something from @tanstack/react-router or @tanstack/start
  3. run the typescript compiler

Expected behavior

I would expect the file extensions in the .d.ts file to be present.

Screenshots or Videos

No response

Platform

  • OS: macos
  • Version: 1.50.1

Additional context

No response

  1. schiller-manuel(GitHub profile, opens in a new tab) assignedschiller-manuel

  2. SeanCassiere added labelsbug

  3. 🤔 I’ve just tried the latest version start: 1.51.3 and react-router: 1.51.2 and I still get those errors:

    node_modules/@tanstack/react-router/dist/esm/fileRoute.d.ts:54:31 - error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './useNavigate.js'?
    
    54     useNavigate: () => import('./useNavigate').UseNavigateResult<string>;
                                     ~~~~~~~~~~~~~~~
    
    node_modules/@tanstack/react-router/dist/esm/index.d.ts:58:118 - error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './utils.js'?
    
    58 pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils';
                                                                                                                            ~~~~~~~~~
    
    node_modules/@tanstack/start/dist/esm/client/index.d.ts:8:70 - error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../constants.js'?
    
    8 export { serverFnPayloadTypeHeader, serverFnReturnTypeHeader, } from '../constants';

    See also: https://stackblitz.com/edit/github-yk78pg-sd8raq?file=src%2Fmain.tsx

  4. sorry this issue got autoclosed when merging the PR but no release was triggered. now that 1.51.4 is released, those imports are fixed, see also https://arethetypeswrong.github.io/?p=%40tanstack%2Freact-router%401.51.4

  5. Thanks for the fast reaction. I’ve tried 1.51.4 now and can confirm the issues in @tanstack/react-router are resolved, however there is still one issue in @tanstack/start left:

    node_modules/@tanstack/start/dist/esm/client/index.d.ts:8:70 - error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../constants.js'?
    
    8 export { serverFnPayloadTypeHeader, serverFnReturnTypeHeader, } from '../constants';
                                                                           ~~~~~~~~~~~~~~
    
    
    Found 1 error in node_modules/@tanstack/start/dist/esm/client/index.d.ts:8

    See also https://arethetypeswrong.github.io/?p=%40tanstack%2Fstart%401.51.4

  6. please create a new issue so this is properly tracked

Sign in to join this conversation.