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

[TypeScript 5.7] Parsing error: Invalid value for lib provided: es2024.promise #772

Open
yoursunny opened this issue Dec 1, 2024 · 5 comments

Comments

@yoursunny
Copy link

When XO is installed alongside TypeScript 5.7 and tsconfig.json .compilerOptions.lib includes "ESNext.Promise", the XO CLI reports a parsing error.

package.json

{
  "private": true,
  "type": "module",
  "packageManager": "[email protected]+sha512.c8180b3fbe4e4bca02c94234717896b5529740a6cbadf19fa78254270403ea2f27d4e1d46a08a0f56c89b63dc8ebfd3ee53326da720273794e6200fcf0d184ab",
  "dependencies": {
    "typescript": "~5.7.2",
    "xo": "^0.59.3"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "forceConsistentCasingInFileNames": true,
    "lib": [
      "DOM",
      "ES2023",
      "ESNext.Promise"
    ],
    "module": "ES2022",
    "moduleResolution": "Bundler",
    "noEmitOnError": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": true,
    "strict": true,
    "target": "ES2023"
  },
  "include": [
    "main.ts"
  ],
  "exclude": [
    "**/node_modules"
  ]
}

main.ts

console.log(typeof Promise.withResolvers);

Command Line

./node_modules/.bin/xo --fix

Error Message


  main.ts
  ✖  Parsing error: Invalid value for lib provided: es2024.promise  

  1 error
@fregante
Copy link
Member

fregante commented Dec 12, 2024

Fixed by xo 0.60.0

XO ships with its own typescript version and es2024.promises is v5.7.0+

@yoursunny
Copy link
Author

Tested again with xo 0.60.0.
The problem persists.

@fregante
Copy link
Member

What's the output of npm ls typescript? XO uses the latest TypeScript version now

@yoursunny
Copy link
Author

What's the output of npm ls typescript?

ubuntu@ndndev:~/eslint-bug$ corepack pnpm ls typescript
Legend: production dependency, optional only, dev only

/home/ubuntu/eslint-bug (PRIVATE)

dependencies:
typescript 5.7.2

@fregante
Copy link
Member

└─┬ [email protected]
  ├─┬ @typescript-eslint/[email protected]
  │ └── @typescript-eslint/[email protected] deduped
  ├── @typescript-eslint/[email protected]
  └─┬ [email protected]
    └── @typescript-eslint/[email protected] deduped

It seems that XO's deps are out of date. The parser is already at 8.18

https://www.npmjs.com/package/@typescript-eslint/parser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants