Open bkniffler opened 4 years ago
2 Quick notes: 1) Yes, we should add type operators, probably requires work with the TypeChecker. 2) We already validate at runtime, as we compile TS Types into JSON-Schema(ish) metadata we use for validation, so you don't need to duplicate here probably.
Thanks for pointing out! Unfortunately it doesn't really fit well into my particular workflow where I'm using Lambda and got a core library that's shared by multiple lambdas to do the validation according to the types I mentioned above. I know that tsoa has a generator with handlebars, but I think this would make my stack more complicated instead of easier. Would love to use tsoa solely to generate a doc for all my lambdas and the above problem is the only one that's holding me back.
Expected Behavior
I'd like to use typeof based request / response types, since I'm using the input / output objects for runtime validation purposes and I'd like to keep the code as simple as possible. Check below code for an example.
ValidationMapper is a little helper I've attached to convert objects like
{ name: "?string" }
to types like{ name: string | undefined }
Current Behavior
Error: