Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-68810

Use TypeScript to write GUI logic in Qt Quick (instead of JavaScript or C++)




      QML integrates seamlessly with JavaScript (JS), either by adding JS Expressions directly in QML documents, or by keeping QML and JS in separate files, and having QML import the JavaScript as described here. The second approach is of course much cleaner when it comes to larger JS logic.

      As discussed with Simon Hausmann in the Qt Contributor Summit, this is a request to add functionality to Qt Quick (QML) and to Qt Creator to use separate TypeScript (TS) files as resources (instead of JS). Please note that this is not about extending QML itself to be statically typed as described in QTBUG-68791. It's just about including *.ts files into QML.

      Using TS would make it possible to write larger non-visual logic in a statically typed language, without having to accept the limitations of JavaScript and without having to use C++ (which is overwhelming for some developers). It would also make it possible to leverage the Web ecosystem, e.g. use node.js and other npm packages.

      In a first step, this would require to use TS files for build and execution:

      • being able to import *.ts files in QML files
      • executing the TS compiler as part of the build process
      • picking up the resulting *.js file as part of the run-time resources

      In a second step, it would be very convenient to provide first-class support for TS files in the Qt Creator, to edit them and and to debug them. This means that Qt Creator would have to know how to use source maps.


          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              shausman Simon Hausmann
              vbaggiol Vito Baggiolini
              10 Vote for this issue
              13 Start watching this issue



                  Gerrit Reviews

                  There are no open Gerrit changes