Upgrading JavaScript

link - learn.microsoft.com/en-us/office/dev/add-ins/develop/convert-javascript-to-typescript

Converting a JavaScript Project to a TypeScript Project

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

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

Download the type definition files for Office.js
link - 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

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrev