Description:
The projection options for persistent classes should include an option to project them to a TypeScript interface.
Target Audience:
Since some of the most popular front-end frameworks such as Angular, React, and Vue.js offer TypeScript integration (or in Angular's case, rely on it entirely!), automatically generating these interfaces could make the front-end programming much more streamlined. This would be a great gift for those front-end programmers.
Problem:
Creating a TypeScript interface for use with a front-end can be very time-consuming, and doing it manually can lead to omissions and errors. Also, keeping the front end and back end in sync whenever changes are made to the persistent class can become a chore.
Positive Impacts:
This would make using several of the available front ends more reliable and would streamline this part of the development process. This would also create yet another competitive advantage for InterSystems when potential new customers are choosing a back end.
Use cases:
For some specific examples, having the interfaces defined and implemented properly makes it possible for TypeScript to recognize the data types of your class's fields so that it can alert you when you are using the wrong data type. It also can recognize if you've mistyped a field name or are trying to change a field that is read-only.
Thank you for submitting the idea. The status has been changed to "Future consideration".
Stay tuned!
@Stefan Wittmann - should this be assigned to you?