From c05da87ec1039278ae77d3e3b53432614398d8a8 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Fri, 24 Mar 2023 23:41:52 +0100 Subject: move (most of the) JavaScript code to TypeScript Yay, types! (And a lot of escape hatches) --- doc/developer/js-css.rst | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'doc/developer') diff --git a/doc/developer/js-css.rst b/doc/developer/js-css.rst index 016dab1..3193d58 100644 --- a/doc/developer/js-css.rst +++ b/doc/developer/js-css.rst @@ -56,5 +56,19 @@ compile the right SASS files:: Compiling TypeScript -------------------- -Fietsboek does not *yet* use TypeScript. The JavaScript file -:file:`fietsboek/static/fietsboek.js` can be edited by hand. +The TypeScript source is located in :file:`asset-sources`. The +:file:`tsconfig.json` contains the necessary settings for the TypeScript +compiler, as such you can simply run ``tsc`` to compile the sources: + +.. code-block:: bash + + npx tsc + # Alternatively, keep watching for file changes: + npx tsc -w + +To complement the ``just compile-sass`` command, a ``just compile-typescript`` +command also exists as an alias for ``npx tsc``. + +When changing the TypeScript code, you should also run ``eslint``:: + + npx eslint asset-sources/fietsboek.ts -- cgit v1.2.3