We use typia partially to test the types that endpoints return. Since assertEquals throws an error with only the first incorrect property, we instead use something like testType(() => validateEquals(...)) to get a full report of all the errors.
I wanted to make it less verbose by using a custom transform ahead of typia so testType<SomeType>(someValue) would be transformed to const result = validateEquals<SomeType>(someValue) + some more code to check the result and throw an error if it's not valid and then typia would take it from there, but for some reason the transformed code doesn't seem to get passed to typia. I'm not sure how it exactly goes wrong.
We use typia partially to test the types that endpoints return. Since assertEquals throws an error with only the first incorrect property, we instead use something like
testType(() => validateEquals(...))
to get a full report of all the errors.I wanted to make it less verbose by using a custom transform ahead of typia so
testType<SomeType>(someValue)
would be transformed toconst result = validateEquals<SomeType>(someValue)
+ some more code to check the result and throw an error if it's not valid and then typia would take it from there, but for some reason the transformed code doesn't seem to get passed to typia. I'm not sure how it exactly goes wrong.I've set up a quick project to demonstrate what I'm doing and what the current result is repo: https://github.com/KristjanTammekivi/typia-experiment/tree/master transformer: https://github.com/KristjanTammekivi/typia-experiment/blob/master/transform/src/transform.ts incorrect result: https://github.com/KristjanTammekivi/typia-experiment/blob/master/example-usage/dist/example-typetest.js
A file that I used validateEquals in explicitly to demonstrate that typia transform is indeed in the transforms list: https://github.com/KristjanTammekivi/typia-experiment/blob/master/example-usage/dist/example-validateequals.js