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
Node.js for a while has a way to define import aliases (known as subpath imports) in package.json file. The subpath imports also work fine when I compile my code using tsc and inside my code editor (VSCode).
However, as I type the import path in my code editor, no suggestions related to subpath imports are shown.
Given, I have the following subpath import alias inside package.json.
I should be able to type #controllers and get suggestions. Infact, using an export symbol from one of the controller files should write the auto-import using the alias.
tsconfig.json
Following is a trimmed down version of my tsconfig.json file.
Since, TypeScript can understand and compile subpath imports, it will be great, if they are also suggested during import autocomplete
📃 Motivating Example
Have nice experience of auto-importing files with aliases.
💻 Use Cases
Right now, I have to either manually type the complete import statement by hand. Or type the export symbol name and update the import path to use the subpath alias.
Suggestion
Node.js for a while has a way to define import aliases (known as subpath imports) in
package.jsonfile. The subpath imports also work fine when I compile my code usingtscand inside my code editor (VSCode).However, as I type the import path in my code editor, no suggestions related to subpath imports are shown.
Given, I have the following subpath import alias inside
package.json.{ "imports": { "#controllers/*": "./app/controllers/*.js" } }I should be able to type
#controllersand get suggestions. Infact, using an export symbol from one of the controller files should write the auto-import using the alias.tsconfig.jsonFollowing is a trimmed down version of my
tsconfig.jsonfile.{ "compilerOptions": { "target": "ESNext", "module": "NodeNext", "lib": ["ESNext"], "rootDir": "./", "outDir": "./build", "esModuleInterop": true, "skipLibCheck": true, "types": ["@types/node"] }, "include": ["./**/*"], "exclude": ["./node_modules", "./build"] }🔍 Search Terms
✅ Viability Checklist
⭐ Suggestion
Since, TypeScript can understand and compile subpath imports, it will be great, if they are also suggested during import autocomplete
📃 Motivating Example
Have nice experience of auto-importing files with aliases.
💻 Use Cases
Right now, I have to either manually type the complete import statement by hand. Or type the export symbol name and update the import path to use the subpath alias.
Attaching a small screen recording of the same
subpath-imports.mov