-
Notifications
You must be signed in to change notification settings - Fork 527
Description
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 enabled
import { 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
intsconfig.json
compilerOptions - use tsoa
Context (Environment)
Version of the library: tsoa@6.2.1
Version of NodeJS: 20
- Confirm you were using yarn not npm: [X]
Detailed Description
Allow for a config option e.g. called rewriteRelativeImportExtensions
, which supports the new TypeScript 5.7 feature rewriteRelativeImportExtensions
Breaking change?
None