Skip to content
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

Can't use Typescript 4 features / Use project's Typescript version #1121

Closed
thany opened this issue Mar 11, 2022 · 2 comments
Closed

Can't use Typescript 4 features / Use project's Typescript version #1121

thany opened this issue Mar 11, 2022 · 2 comments
Labels
scope: dependencies Pull requests that update a dependency file solution: duplicate This issue or pull request already exists solution: workaround available There is a workaround available for this issue

Comments

@thany
Copy link

thany commented Mar 11, 2022

Current Behavior

It's compiling against its own installed version of typescript 🤨

Expected behavior

Use the typescript version that's installed with a project, to compile it.

Suggested solution(s)

Set typescript as a peerDependency and tell users to install it themselves. I dont know how TSDX would handle that, but dictating a specific version is ridiculous, given the amount of new features Typescript still has from version to version.

Additional context

I don't want to be dependent on TSDX to dictate which version of Typescript can be used. Doesn't that make sense?

Your environment

  System:
    OS: Windows 10 10.0.19043
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 10.51 GB / 31.76 GB
  Binaries:
    Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.3.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 99.0.4844.51
    Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.36)
    Internet Explorer: 11.0.19041.1202
  npmPackages:
    tsdx: 0.14.1 => 0.14.1
    typescript: 4.4.2 => 4.4.2

(browser is missing though, but who cares about browsers in TSDX)

@thany
Copy link
Author

thany commented Mar 14, 2022

A workaround, if you can even call it that, is to use overrides in the package.json:

{
  "overrides": {
    "tsdx": {
      "typescript": "4.4.2"
    }
  }
}

Now, every single mention of the use of overrides, on the whole internet, entirely fails to mention that you should also reinstall any affected packages, so following this change with a npm i tsdx should solidify this override.

However, it's a really sorry excuse for a workaround, because it reveals errors when doing a npm list --depth=1. At least this command reveals if the override has worked:

image

In my case, those errors do not appear to break anything, but still. I feel dirty 🙂 This just emphasises how important it is to keep up.

@agilgur5
Copy link
Collaborator

Duplicate of #926 etc

Regarding peerDeps, that is much easier said than done, please see #985 (comment) for a summary.

Repository owner locked as resolved and limited conversation to collaborators Apr 11, 2022
@agilgur5 agilgur5 added scope: dependencies Pull requests that update a dependency file solution: workaround available There is a workaround available for this issue labels Apr 11, 2022
@agilgur5 agilgur5 added the solution: duplicate This issue or pull request already exists label Apr 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope: dependencies Pull requests that update a dependency file solution: duplicate This issue or pull request already exists solution: workaround available There is a workaround available for this issue
Projects
None yet
Development

No branches or pull requests

2 participants