You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AJV cannot infer which subtype of a union is being used when creating a union over objects. This might be an issue with AJV core, or just an issue with the error handling.
Below is a simple but complete example of the issue:
When I specify actionType: 'UPLOAD', I expect that the only missing fields should url and filename. The errors output by AJV are confusing and misleading.
In contrast, the typescript type inference engine is correctly able to deduce the the missing fields once the actionType field is set to one of EMAIL or UPLOAD.
Problem description
AJV cannot infer which subtype of a union is being used when creating a union over objects. This might be an issue with AJV core, or just an issue with the error handling.
Below is a simple but complete example of the issue:
Run this using
ts-node
or compile and run it via node. The output I get isWhen I specify
actionType: 'UPLOAD'
, I expect that the only missing fields shouldurl
andfilename
. The errors output by AJV are confusing and misleading.In contrast, the typescript type inference engine is correctly able to deduce the the missing fields once the
actionType
field is set to one ofEMAIL
orUPLOAD
.Here are my versions via
yarn list
:The text was updated successfully, but these errors were encountered: