DEV Community

Discussion on: Type-Safe Web Components with JSDoc

Collapse
 
dakmor profile image
Thomas Allmer

For runtime validators I'm not really sure if that can bring the functionality you want. Maybe take a look at Type Safety at Runtime where it argues that only you as a developer can truly make it happen.

For validation of API responses there is the OpenAPISpecification or Pact to get a strong contract for responses. I agree it would be nice to get types from the backend to the frontend but I do not know if there is any active development for such a spec. I know that certain full stack frameworks offer such functionality but to as far as I know these are always proprietary solutions with no intention to becoming a spec.

For markup type safety VS Code is currently working on using a web components "declaration file". Currently, it only supports attributes so please join the conversation and lets extend it with properties as well :)

Collapse
 
thepassle profile image
Pascal Schilp • Edited

Vaadin Connect is pretty cool, it generates TypeScript types for whatever you return from your java backend