4 ms·
Hang on, so this is doing runtime validation of an object against a typescript type definition? Can this be shipped as a standalone library/feature? This would
by katamaster818 3y ago
Hang on, so this is doing runtime validation of an object against a typescript type definition? Can this be shipped as a standalone library/feature? This would be absolutely game changing for validating api response payloads, etc. in typescript codebases.
- tehsauce 3y agomaybe this function? https://github.com/microsoft/TypeChat/blob/4d34a5005c67bc49444e6e6d016a9262cf24b38d/src/validate.ts#L57 https://github.com/microsoft/TypeChat/blob/4d34a5005c67bc494...
- katamaster818 3y agoyup, just found that, super neat, I am 100% interested in using this for other runtime validation... It's interesting because I've always been under the impression the TS team was against the use of types at runtime (that's why projects like https://github.com/nonara/ts-patch https://github.com/nonara/ts-patch exist), but now they're doing it themselves with this project... I wonder what the performance overhead of starting up an instance of tsc in memory is? Is this suitable for low latency situations? Lots of testing to do...
- jacamera 3y agoGreat point. They're against it unless you're running it in a loop and paying for every API call!