Upgrading JavaScript


Converting a JavaScript Project to a TypeScript Project

Rename any ".js" files to ".ts".


Download the type definition files for jQuery
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jquery/jquery.d.ts
npm - @types/jquery


Download the type definition files for Office.js
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/office-js/index.d.ts
npm - @types/office-js


Check the references in all the '.ts' files.
Open Home.ts


Create a new file at the root tsconfig.json


{ 
    "compilerOptions": {
        "skipLibCheck": true,
        "lib": [ "es5", "dom", "es2015.promise" ]
    }
}


Project Properties - TypeScript Build Tab
check the ECMAScript version



The compiler will generate javascript files from the typescript files so your html files should continue to reference the '.js' files.
The compiler will also generate '.js.map' files





© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext