GoogleFeud / ts-runtime-checks

A typescript transformer that automatically generates validation code from your types.
https://googlefeud.github.io/ts-runtime-checks/
MIT License
312 stars 7 forks source link

[BUG] TypeScript 5.1.6 - Namespace 'ts' has no exported member 'TypeMapper'. #22

Closed FredTreg closed 1 year ago

FredTreg commented 1 year ago

Describe the bug When using npx tspc with TypeScript 5.1.6 on a source file using Assert, I get the following error:

root ➜ /workspace/coucou/server (main) $ npx tspc 
node_modules/ts-runtime-checks/dist/gen/validators/genValidator.d.ts:6:16 - error TS2694: Namespace 'ts' has no exported member 'TypeMapper'.

6     mapper: ts.TypeMapper;
                 ~~~~~~~~~~

Found 1 error in node_modules/ts-runtime-checks/dist/gen/validators/genValidator.d.ts:6

Additional context Version 0.3.0 Using the "skipLibCheck": false option

Workaround Use "skipLibCheck": true in tsconfig.json

GoogleFeud commented 1 year ago

Must be because this library uses @types/ts-expose-internals which exposes internal types. Try installing it (add "@types/ts-expose-internals": "npm:ts-expose-internals@^5.1.5" to your devDependencies) and the issue should be fixed!

FredTreg commented 1 year ago

I confirm the issue was fixed by adding "@types/ts-expose-internals": "npm:ts-expose-internals@5.1.6" to my devDependencies