Code Monkey home page Code Monkey logo

Comments (17)

danielpza avatar danielpza commented on May 31, 2024 1

@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.

nonara avatar nonara commented on May 31, 2024 1

This issue has been resolved in v3.4!

from typescript-transform-paths.

patrickkunka avatar patrickkunka commented on May 31, 2024 1

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.

nonara avatar nonara commented on May 31, 2024

Thanks for the report, Luke. What version of TS are you using?

from typescript-transform-paths.

lukemorales avatar lukemorales commented on May 31, 2024

@nonara TS version 4.0.3, latest available in VSCode

from typescript-transform-paths.

nonara avatar nonara commented on May 31, 2024

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.

nonara avatar nonara commented on May 31, 2024

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.

nonara avatar nonara commented on May 31, 2024

Closing for housekeeping. Feel free to comment if you think this was in error.

from typescript-transform-paths.

saqirmdevx avatar saqirmdevx commented on May 31, 2024

Hello i got same issue here with latest version of Typescript and your plugin

Screenshot 2022-08-20 at 14 09 22

Javascript (Compiled import version)
Screenshot 2022-08-20 at 14 11 12

Basically "import type" remains in the file while it should be removed.

This is typescript file
Screenshot 2022-08-20 at 14 12 05

from typescript-transform-paths.

nonara avatar nonara commented on May 31, 2024

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 avatar saqirmdevx commented on May 31, 2024

@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.

patrickkunka avatar patrickkunka commented on May 31, 2024

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.

nonara avatar nonara commented on May 31, 2024

Thanks, all. Sounds like an issue with new TS. I'll have a look.

from typescript-transform-paths.

patrickkunka avatar patrickkunka commented on May 31, 2024

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.

patrickkunka avatar patrickkunka commented on May 31, 2024

Brilliant, I will give it a whirl next week

from typescript-transform-paths.

patrickkunka avatar patrickkunka commented on May 31, 2024

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.

nonara avatar nonara commented on May 31, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.