Closed climba03003 closed 8 months ago
It somehow working on my side. Keep all packages the latest always the key in TypeScript world.
Interesting, it error only when using tsc
but not the runtime.
The problem is non-strict mode.
The problem is non-strict mode.
Confirmed.
Even with this change, tsserver still complains on my machine.
Even with this change, tsserver still complains on my machine.
The same error? Maybe try it from fresh.
git clone https://github.com/fastify/fastify-type-provider-json-schema-to-ts.git
cd fastify-type-provider-json-schema-to-ts
git checkout update
npm install
npm run build
npm run typescript
The compilation still fail without --strict
as well.
The strictNullChecks
flag seems to be enough: npx tsc --strictNullChecks --noEmit types/*.ts
doesn't emit any error.
Probably the library you are using relies on having null
and undefined
as distinct types while checking some base case for some recursive computation.
If strictNullChecks
is false
, null
and undefined
are assignable to all types, therefore any extends
check could change behaviour if the checked type is null
or undefined
.
The documentation of json-schema-to-ts says exactly that strict: true
is required
@jfet97 Good point. If that is so, we should document it also in this repo.
Closes #70 Closes #71 Fixes #68
Checklist
npm run test
andnpm run benchmark