-
-
Notifications
You must be signed in to change notification settings - Fork 28
Declaration files paths not being transformed when using 'import type...' #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report, Luke. What version of TS are you using? |
@nonara TS version 4.0.3, latest available in VSCode |
I can't reproduce on this end. The following transforms properly for me:
export type A = string;
import type { A as ATypeOnly } from '#root/file1'
export { ATypeOnly } Can you create a reproduction? |
I've added tests to ensure type-only import works, and everything seems to be ok. Are you using v2+? If you can find a way to reproduce with two files, please let me know and I'll look into it. |
Closing for housekeeping. Feel free to comment if you think this was in error. |
@saqirmdevx Can you share your tsconfig.json configuration? What typescript and typescript-transform-paths versions are you using?
|
It's possible that the latest TypeScript has updated something involving Type Elision. We had to replicate this functionality locally. @saqirmdevx Can you share a small reproduction repo? @danielpza Good to see you again, Daniel! How've you been? |
Hello! I am sorry i already using different method (i created custom script that update paths after compilation). I believe tsconfig is unchanged: (Paths might be different) {
"compilerOptions": {
/* Basic Options */
"target": "ESNext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "ESNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"outDir": "build" /* Redirect output structure to the directory. */,
"rootDir": "../" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
"removeComments": true /* Do not emit comments to output. */,
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
/* Module Resolution Options */
"moduleResolution": "node",
"baseUrl": ".",
"esModuleInterop": true,
"paths": {
"@/*": ["src/*"]
}
},
"include": [
"src/**/*.ts",
"../shared/*.ts"
],
"exclude": [ "../client/**"]
} I was using latest typescript (stable version) and latest typescript-transform-paths. |
I am currently also experiencing the issue as described by @saqirmdevx whereby typescript: 4.8.4 |
Thanks, all. Sounds like an issue with new TS. I'll have a look. |
Not sure if related, but I see the following warning in the console when I run
|
This issue has been resolved in v3.4! |
Brilliant, I will give it a whirl next week |
Apologies for the delay. I just tried version 3.4.4 but the issue still persists. There are |
@patrickkunka What version of TS? If it's 4.9, there's an issue affecting most transformers, including this. In that case it would not work at all. If the problem happens with ts 4.8, if you can provide a quick repro, I will check it out. The issues reported in this thread were definitely corrected, so I'd have to dig in to see what you're facing. |
Hi @nonara it's still 4.8.4 as reported above. I'll try to create an isolated repro for you today. |
I've been struggling with the generated declaration files paths not being transformed to relative paths and I was using i.e
import type { Type } from '@/common/types'
.I removed all
import type {}
and replaced with the standardimport { Type } from '@/common/types'
and it transformed correctly in the declaration files, so there seems to be a problem resolving theimport type
syntax 🤔The text was updated successfully, but these errors were encountered: