You can keep the JavaScript code in a separate external file and then point to that file from your HTML document.
To use the library you must add the following to one of your ts files: declare var libraryVar: any; Replace libraryVar with a variable, function, or class within your JavaScript library. In the Simple Tasks sample application, the HTML-service page Page.html loads data this way, and only uses templating to include other source code into the page.

In fact, it’s considered very 90s by today’s coding standards.

Load resources using HTTPS.

However, writing JavaScript straight into your HTML pages is not considered a best practice. Create external JavaScript file with the extension .js.

To link to an external JavaScript file, you add a src attribute to the HTML