Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !13071

Allow TypeScript 5+ in `peerDependencies`

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Karl Horky requested to merge github/fork/karlhorky/patch-2 into main Mar 17, 2023
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 1

Now that TypeScript 5 was released (specifically, [email protected]), it would be great to get the restriction on the version of TypeScript removed.

Otherwise npm will throw errors like this, when resolving peer dependencies:

CodeSandbox demo (run npm i in a terminal to get the error below): https://codesandbox.io/p/sandbox/react-scripts-5-0-1-typescript-5-0-2-t48wwi

$ npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/typescript
npm ERR!   dev typescript@"5.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1 || ^4" from [email protected]
npm ERR! node_modules/react-scripts
npm ERR!   react-scripts@"5.0.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/typescript
npm ERR!   peerOptional typescript@"^3.2.1 || ^4" from [email protected]
npm ERR!   node_modules/react-scripts
npm ERR!     react-scripts@"5.0.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /project/home/karlhorky/.cache/npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /project/home/karlhorky/.cache/npm/_logs/2023-03-17T11_12_53_021Z-debug-0.log

Alternatives considered

I could instead do this if desired, which would then need to be updated again each time TypeScript 6, 7, etc are released:

-    "typescript": "^3.2.1 || ^4"
+    "typescript": "^3.2.1 || ^4 || ^5"
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/karlhorky/patch-2