I'm currently designing the architecture for a web application that will require the consumption of SOAP APIs in hundreds, if not thousands, of instances. These implementations will be developed by 200-300 different developers over a span of several years. Understanding the scope of this project and the number of individuals involved, my aim is to streamline the interaction with this SOAP API through Typescript to minimize complexity.
My goal is to avoid requiring each developer to manually convert strings into their respective types every time a request is made to the API. To achieve this, I am working on handling the conversion process for them. However, due to Typescript's limitations in reflection capability, this task has proven to be somewhat challenging. I have resorted to using a PropTypes approach.
Unfortunately, this approach involves duplicating the structure definition, as it needs to be available in both the TS type (compile-time/type space) and the PropTypes package (run-time/value space). While omitting some implementation details for brevity, I have devised a solution utilizing the prop-types package as seen below:
/* code snippet */
Despite my efforts, I am concerned about the potential for divergence between the two definitions of the User
type. As a newcomer to Typescript, I am curious if there are more conventional or intuitive ways within Typescript to tackle this challenge that I might have overlooked?