I’ve created a new Typescript project using
mkdir zod-ts
cd zod-ts
npm init // all options default
npx tsc init
This creates the following tsconfig.json
target: es2016
module: commonjs
strict: true
esModuleInterop: true
skipLibCheck: true
forceConsistentCasingInFileNames: true
I install zod and other packages with npm install zod @types/node typescript
I then create an index.ts
file with the following code
import { z } from "zod";
const myType = z.object({
myprop: z.string().optional(),
});
console.log(myType);
I then run tsc index.ts
and I’m greeted with the following error: node_modules/zod/lib/types.d.ts:777:5 - error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
As skipLibCheck: true
I’d expect it to ignore this, but it’s not.
What am I doing wrong here?