Goal: Upgrade antd from 4.19.0 to 4.20.0
Preparation: Initially, I upgraded directly from 4.19.0 to 4.19.1 then to 4.19.2 and got to first error as shown below. I followed the incremental upgrade, i.e. upgrade package version wise.
We can check the current version of
antd with command
npm ls antd. It shows the current version as 4.19.0.
- Install antd version 4.19.2
npm install --save email@example.com
Check to see if it works fine or not with
NODE_ENV=development npm run dev
I faced my first issue that needed me to upgrade TypeScript version.
Fixed above errors by upgrading typescript version from 3.8.3 to latest version, which is 4.6.3 while writing this post.
2. Upgrade TypeScript
npm install --save typescript@latest
After TypeScript version was upgraded, the first issue was fixed. Then, I tried running
npm run dev again and got another issue “Object is of type ‘unknown'”. This issue occurred because I had upgraded TypeScript from 3.8.3 to 4.0.0, and in 4.0.0 error type was changed from any to unknown in catch block by default details are here
npm run dev
To resolve it, open
tsconfig.json and enter
"useUnknownInCatchVariables": false, in compilerOptions section.
npm run dev worked fine without errors.
Upgrade antd to 4.20.0
npm install --save firstname.lastname@example.org
The installation went fine and I could also run
npm run dev without issue. Finally, we are at email@example.com