Closed beanaroo closed 3 years ago
I realised a very important detail from the documentation that I missed:
const MyEventPayloadSchema = {...} as const;
The const assertion is required to avoid the above error.
What I originally tried to do was import the schema directly from a json
file as produced by an API Designer (Stoplight Studio).
This results in the same error but sadly, there does not appear to be a const assertion for this type of import (yet):
This library looks great! Experimenting with a trimmed down version of my schema:
TypeScript 4.2.2 compilation fails with:
tsconfig.json
```json { "compilerOptions": { "declaration": true, "lib": [ "ESNext" ], "target": "ES2019", "module": "CommonJS", "outDir": "lib", "strict": true, "noImplicitAny": false, "moduleResolution": "node", "esModuleInterop": true, "skipLibCheck": true, }, "include": [ "src/**/*.ts", ".eslintrc.js" ] } ```