xojs/xo

Error with typescript 5.0 features and yarn

melusc opened this issue · 2 comments

melusc commented

When using yarn and typescript 5.0 features (eg. verbatimModuleSyntax) it throws because xo uses typescript@^4.9.3 and then doesn't understand the new options.
Yarn won't bump it to 5.0 because the bump is a major change. This is an issue with both regular yarn and yarn berry (but not npm).
I've bumped it by modifying yarn.lock and nothing broke, so it should probably be an easy fix

I've created a repo: https://github.com/melusc/xo-ts5.0-yarn

yorch commented

You can also force yarn to resolve typescript v5 for xo using the following in your package.json:

  "resolutions": {
    "typescript": "5.0.3"
  },

Tested with yarn v3

❯ yarn why typescript
├─ export-service-poc@workspace:.
│  └─ typescript@patch:typescript@npm%3A5.0.3#~builtin<compat/typescript>::version=5.0.3&hash=85af82 (via patch:typescript@npm%3A5.0.3#~builtin<compat/typescript>)
│
├─ xo@npm:0.53.1
│  └─ typescript@patch:typescript@npm%3A5.0.3#~builtin<compat/typescript>::version=5.0.3&hash=85af82 (via patch:typescript@npm%3A5.0.3#~builtin<compat/typescript>)
│
└─ xo@npm:0.53.1 [1d9ee]
   └─ typescript@patch:typescript@npm%3A5.0.3#~builtin<compat/typescript>::version=5.0.3&hash=85af82 (via patch:typescript@npm%3A5.0.3#~builtin<compat/typescript>)
yorch commented

Although there are other things that need to be updated in xo to fully support TS v5 like: #711