So i'm using swagger and Nswag for a very long time, I can see the auto generated methods used to generate a line like this to exit as default value:
return _observableOf<MyClassData>(<any>null);
...And now with the same nswag json file, it generates this way:
return _observableOf(null);
Which seems to be valid for Angular 9 because it did not support strict=true, but now with my Angular 11/12 projects, this throws an error that says:
error TS2322: Type 'Observable' is not assignable to type 'Observable'. Type 'null' is not assignable to type 'MyClassData'.
Solution 1) Manually replace the auto generated file by adding: return _observableOf < MyClassData >(< any > null); which is crazy because everytime I generate the file, I will lose the changes.
Solution 2) Open/edit the angular.json, in the schematics/angular:application, strict: change it from true to false, of course it stops failing, but I would very prefeer to keep the code as strict.
What could be the best solution here? Is there a way to specify to NSWAG that should keep returning as it was doing it in the past?
Thanks.