-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Issue with v7 & TypeScript 3.2 for array or object validation #64
Comments
Waiting for microsoft/TypeScript#29168 |
This was referenced Dec 27, 2018
This was referenced Jan 17, 2019
Closed
Fixed in #74, which will be released in v8. Keeping the issue open for v7 documentation. |
v8 beta is available for testing, see #76 |
This is fixed in v8. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
In v7 of the lib, due to this regression in TypeScript 3.2, there is a problem with JSON schemas for objects or array validation if you use the generic
JSONSchema
interface:or if you put a schema for an object or array directly in the method options:
Other schemas (string, numeric, boolean) are not affected.
Despite it's a regression, TypeScript team visibly doesn't plan to fix this until TypeScript 3.4 (yes, you've heard right...). So it has been decided to not support TypeScript 3.2.
If you're still on Angular 7.0 or 7.1 (so with TypeScript 3.1), there will be no problem with compilation. But as VS Code already uses TypeScript 3.2, errors can appear inside the editor.
If you upgraded to Angular 7.2, stick to TypeScript 3.1. Angular 7.2 still supports TS 3.1, and TS 3.2 adds nothing very interesting (except issues), so there is no need to rush the update. If you upgrade your Angular app via
ng update
, the CLI may update to TS 3.2, so revert this with this command:TS 3.2 issue can be bypassed by casting each JSON schema and subschemas, but we do not recommend this option as it requires a lot of work, that may need to be reverted in v8 of this lib.
Version 8 of the lib will fix these TS problems once and for all (already ready in #74). But as it will imply some breaking changes, I have to wait for v8.
Another solution is to go back to v6 of the lib, which supports Angular 7 with TypeScript 3.1 and TypeScript 3.2:
Sorry for this issue, but it's beyond my control and TS team doesn't care.
The text was updated successfully, but these errors were encountered: