Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor
Last few weeks I’ve been posting blog posts in combination with video tutorials on different aspects of how I develop my apps by using TypeScript in UI5. In the end all parts are connected to each other with each its own responsibility. It will enable you to make a UI5 freestyle app well structured and easily maintained in TypeScript. Not only because of TypeScript but because of separating everything into parts. You won’t have files with an insane number of lines with code that is not maintainable! It will also make it easier to find things back.


Maybe you recognize this setup, I presented something similar at UI5con in 2019. Same setup but not yet in TypeScript:


In this blog post I want to summarize all parts of the last few weeks.

Starting with a general intro about TypeScript in UI5:

Followed by generating a UI5 project in TypeScript:

Adding a TypeScript BaseController:


After that I added layers that build up each other to setup a good skeleton to build a freestyle UI5 app that allows you to do anything and still keep it simple. A Service layer that works with promises using the initially created OData model.

A state/model manager that consumes this service to feed an internal model with instances of classes stored in a JSON model.

An Overview on how it is all connected:


  • The NorthwindService that uses the ODataModel for sending HTTP requests and wraps it in promises

  • NorthwindState uses the NorthwindService to get the data, wraps it in instances of classes and stores it in an internal JSON model

  • The components creates an instance of the NorthwindService with the ODataModel as an argument and the NorthwindState with the instance of the NorthwindService as an argument

  • The controller or component sets the model of the NorthwindState on the component or view so it can be used for bindings


The details on the service layer that explain how the service wrapper works and how to consume it:


The state/model manager explained in combination with its classes:


The final part that shows already a small benefit of this setup. The bigger it becomes the more you’ll benefit from it:


It all comes with two GitHub repos, one with the full example:


Another one that only shows the service layer in case you are only interested in this part:


I also created a playlist for all videos in the blog posts:

It’s not because I developed apps like this before the same way that I wanted to the exact same thing with TypeScript. I just tried and wanted to get the most out of TypeScript. It seemed logical that this way TypeScript is fully used with the types in the OData wrapper and the classes in in the model layer.

Nevertheless, I would be happy to receive feedback on how you develop in UI5 with TypeScript. Or if you have ideas on how to improve this! Any feedback is welcome!

1 Comment
Labels in this area