JET In Typescript
        Oracle® JavaScript Extension Toolkit (JET)
            17.1.0
        G12196-01
Overview
This guide explains how to use JET in your Typescript project. JET's Typescript type definitions are bundled with the JET npm package. These type definitions get installed automatically when you install the JET library from npm. To get the latest recommended tsconfig.json in an existing Javascript or Typescript JET project, you can run the following command:
ojet add typescriptojet create AppName --template=(blank|basic|navbar|navdrawer) --typescriptJET Typescript type definitions include definitions for JET elements as well as non element classes, namespaces, interfaces etc. The below sections explain how each of these modules can be imported in to your project and used.
Working with JET Elements
  JET Elements are exported as Typescript interfaces. These interfaces are useful in typechecking the element APIs but have
  no run time impact. 
  Import a JET element in your viewmodel, as below,
  
import {ojInputText} from "ojs/ojinputtext";import {ojInputText} from "ojs/ojinputtext";
import "ojs/ojinputtext";import {ojInputText, ojInputPassword} from "ojs/ojinputtext";
import "ojs/ojinputtext";Cast your HTML element to JET Element
To work with a component instance in your view model, you must typecast the element to the correct JET Element type. An example below:-
let myInputText = document.getElementById('input') as ojInputText; let tableElement = document.getElementById('table') as ojTable<number, object>;
Using Element APIs
To get a property value,
let myValue = myInputText.value;myInputText.value = "Hello There";//Note that the expanded always returns Array<{id?: string, index?: number}>.
//But you are allowed to set an array of number or string as expanded.
//The following code will fail.
//myAccordion.expanded' = [1,2,3];
//But you can set expanded to a number array using set method,
myAccordion.set('expanded', [1,2,3]);myAccordion.unset('expanded');myInputText.refresh();
//Create your listener function
myListener = (evt: ojInputText.ojAnimateStart) => {
}
//You can attach this to your component as below,
myInputText.addEventListener("ojAnimateStart", this.myListener);
//HTML code,
<oj-navigation-list data="[[navDataSource]]"
   on-selection-changed="[[selectionChange]]">
</oj-navigation-list>
//Your view model
import {ojNavigationList} from 'ojs/ojnavigationlist';
import "ojs/ojnavigationlist";
class HeaderViewModel {
  navDataSource: ojNavigationList<string, object>['data'];
  selectionChange: (event: ojNavigationList.selectionChanged<string, string>) => any;
  constructor() {
    let self = this;
    //data source will now be typechecked to ensure it is of type DataProvider<string, object>
    self.navDataSource = new ArrayDataProvider(HeaderViewModel.navData, { keyAttributes: 'id'});
    //selection change callback handler's event parameter will now be typed to let you access properties
    //like event.detail.value, event.detail.previousValue etc.
    self.selectionChange = (event) => {
      let newVal = event.detail.value;
      if (newVal !== self.router.stateId()) {
        self.router.go(newVal);
      }
    }
  }
}
Working with non element classes
  JET non element classes, namespaces and interfaces are grouped in to vaious modules. Every module either returns a single class or
  multiple classes in an umbrella object. To use a module correctly, it is important to know what is returned by it.
  You can find details about how to import a class/interface from a module in to your typescript project in the 'Typescript Import Format' section of the class/interface doc. 
  Here is an example of a module which returns a class and how to use it,
  
import ArrayDataProvider = require('ojs/ojarraydataprovider');
let dataprovider = new ArrayDataProvider([{value: 'R', label: 'Red'},{value: 'B', label: 'Blue'}], {keyAttributes: 'value'});
myTableElment.data = dataproviderimport * as Logger from "ojlogger";
Logger.log("The button is clicked");import {Validation, LengthValidatorFactory} from "ojs/ojvalidation-base";
let factory = Validation.validatorFactory('length') as LengthValidatorFactory;
let validator = factory.createValidator({max: 10});
myTextComponent.validators = [validator];