Comments (17)
@saqirmdevx Can you share your tsconfig.json configuration? What typescript and typescript-transform-paths versions are you using?
npm ls typescript
npm ls typescript-transform-paths
from typescript-transform-paths.
This issue has been resolved in v3.4!
from typescript-transform-paths.
Hi @nonara it's still 4.8.4 as reported above. I'll try to create an isolated repro for you today.
from typescript-transform-paths.
Thanks for the report, Luke. What version of TS are you using?
from typescript-transform-paths.
@nonara TS version 4.0.3, latest available in VSCode
from typescript-transform-paths.
I can't reproduce on this end.
The following transforms properly for me:
root-dir/file1.ts
export type A = string;
index.ts
import type { A as ATypeOnly } from '#root/file1'
export { ATypeOnly }
Can you create a reproduction?
from typescript-transform-paths.
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.
from typescript-transform-paths.
Closing for housekeeping. Feel free to comment if you think this was in error.
from typescript-transform-paths.
Hello i got same issue here with latest version of Typescript and your plugin
Javascript (Compiled import version)
Basically "import type" remains in the file while it should be removed.
from typescript-transform-paths.
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?
from typescript-transform-paths.
@saqirmdevx Can you share your tsconfig.json configuration? What typescript and typescript-transform-paths versions are you using?
npm ls typescript npm ls typescript-transform-paths
Hello!
I am sorry i already using different method (i created custom script that update paths after compilation).
I can't remember exactly what tsconfig and version.
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.
from typescript-transform-paths.
I am currently also experiencing the issue as described by @saqirmdevx whereby import type ...
statements are present in JS output.
typescript: 4.8.4
typescript-transform-paths: 3.3.1
from typescript-transform-paths.
Thanks, all. Sounds like an issue with new TS. I'll have a look.
from typescript-transform-paths.
Not sure if related, but I see the following warning in the console when I run tsc
with the plugin applied:
DeprecationWarning: 'updateImportTypeNode' has been deprecated since v4.6.0. Use the overload that accepts 'assertions'
from typescript-transform-paths.
Brilliant, I will give it a whirl next week
from typescript-transform-paths.
Apologies for the delay. I just tried version 3.4.4 but the issue still persists. There are import type ...
statements in the compiled JS output.
from typescript-transform-paths.
@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.
from typescript-transform-paths.
Related Issues (20)
- how to use with tsc? HOT 5
- provided as Transformer Plugin HOT 5
- [Bug] Incorrect transformer signature in types definition file HOT 1
- [Bug] Import assertion is not supported HOT 3
- [Bug?] Index file import not being transformed correctly HOT 4
- Does not work with relative path to a node module folder. HOT 2
- [Feature] TypeScript 4.8 support. HOT 2
- [Bug] Edge cases in ts-node HOT 2
- [Bug] 3.4.1 update breaks decorator HOT 4
- [Bug] Nx Transformer "is not a Transformer Plugin" HOT 4
- [Bug] Paths needlessly go back to root on macOS HOT 6
- Not working for TypeScript 4.9? HOT 7
- What about supporting easy setup CLi command? HOT 2
- [Feature] Add an option to exclude by keys HOT 5
- [Bug] useRootDirs doesn't work properly if outDir specified
- [Bug] Paths are not rewritten on incremental compilation with --watch flag HOT 3
- [Bug] Problem with running via ts-node when entry file is in a different directory HOT 3
- Unexpected behavior in import a local package. HOT 1
- [Bug] Issues with Type Elision
- Bad behaviour with default import because of `esModuleInterop` ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript-transform-paths.