There is one more way to solve the problem, in addition to upgrading your webpack to webpack 5, as Ali Bigdeli’s answer pointed out. You can also just downgrade ts-loader to 8.2.0. Using your package manager of choice, that might look like:
npm install ts-loader@~8.2.0
As pointed out in the Github question
linked by Ali Bigdeli, the last version of ts-loader that supports webpack 4 is 8.2.0, and if you want to receive patches to this version, you can depend on the semver ~8.2.0 version.