You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript 5.7 will support a new compilerOption called "rewriteRelativeImportExtensions", which allows importing .ts extensions for relative paths.
Sorting
I'm submitting a ...
bug report
feature request
support request
I confirm that I
used the search to make sure that a similar issue hasn't already been submit
Expected Behavior
Allow for a config option in tsoa.json to have tsoa output .ts imports in routes.ts.
// should create the following import in routes.ts when rewriteRelativeImportExtensions is enabledimport{UserController}from'./../src/controllers/userController.ts';
Current Behavior
npx tsoa spec-and-routes creates the following routes.ts:
import{UserController}from'./../src/controllers/userController.js';--------------------------------^// This relative import path is unsafe to rewrite because it looks like a file name, but actually resolves to "../src/controllers/userController.ts".
Possible Solution
Allow for a rewriteRelativeImportExtensions-tsoa-config option, which would not rewrite the .ts-extensions to .js.
Or read the tsconfig.json used in the project and determine the rewriteRelativeImportExtensions setting.
Steps to Reproduce
Install TypeScript 5.7 beta
enable rewriteRelativeImportExtensions in tsconfig.json compilerOptions
I can't see the comment for which I received an email, so I'll just reply to this issue in general.
There's no advantage over esm: true, as it's a different use case. rewriteRelativeImportExtensions allows to import .ts files, so that TypeScript-runtimes without build/transpile-step can correctly handle the file resolution.
You can see an example in the beta announcement I linked in my first message.
TypeScript 5.7 will support a new compilerOption called "rewriteRelativeImportExtensions", which allows importing
.ts
extensions for relative paths.Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
Allow for a config option in
tsoa.json
to have tsoa output.ts
imports in routes.ts.Current Behavior
npx tsoa spec-and-routes
creates the followingroutes.ts
:Possible Solution
Allow for a
rewriteRelativeImportExtensions
-tsoa-config option, which would not rewrite the.ts
-extensions to.js
.Or read the
tsconfig.json
used in the project and determine therewriteRelativeImportExtensions
setting.Steps to Reproduce
rewriteRelativeImportExtensions
intsconfig.json
compilerOptionsContext (Environment)
Version of the library: [email protected]
Version of NodeJS: 20
Detailed Description
Allow for a config option e.g. called
rewriteRelativeImportExtensions
, which supports the new TypeScript 5.7 featurerewriteRelativeImportExtensions
Breaking change?
None
The text was updated successfully, but these errors were encountered: