Upgrade to typescript 3.9

Issue #861 resolved
Brian Lewis repo owner created an issue

As per discussion… should be trying to get more assistance from strongly typed code; and upgrading will get the codebase closer to Angular 9.

Also keen to get the “optional chaining” feature of 3.7 which will make a lot of code look cleaner.

First step is to ascertain how much will break.

Comments (5)

  1. Brian Lewis reporter

    Two things steps are required to update typescript - and this is becuase of the non-stndard ( ie old) structure of our project which gets compiled from grunt:

    1. to change the compiler that actually does the compiling: update the version of typescript in packages.json in pineapples.client
    2. to change the version that provides intellisense in the editor:

    go to the VS Package Manager console, and install typescript from there:

    npm install -g typescript@3.7.5

  2. Brian Lewis reporter

    A small number of compile errors were found going from 3.4.1 => 3.7.5. All ultimately related to lodash _.find

    No other compile errors going from 3.7.5 => 3.9.3

  3. Brian Lewis reporter

    Added two small examples of “optional chaining” available from typescript 3.7 ff. Good to be aware of this , can save a bit of awkward code.

    public $onChanges(changes) {
                // isFirstChange() returns true when the bindings are first initialised PRIOR to onInit
                // better to ignore those
                if (changes.dashboard?.isFirstChange()) {
                    return;
                }
    

  4. Log in to comment