call javascript function from ts file code example

Example 1: call ts in javascript

import kb = Knockback;

export module CustomerViewModels
{
  export class CustomerVM extends kb.ViewModel
  {
    Id: number;
    FirstName: string;
    LastName: string;
    CompanyName: string;
    SalesOrdersHeaders: kb.CollectionObservable;
  }
}

Example 2: call ts in javascript

function CreateKnockBackViewModel(cust, orders) {
  var cvm = {
             Id: kb.observable(cust,'Id'),
             CompanyName: kb.observable(cust, 'CompanyName'),
             FirstName: kb.observable(cust, 'FirstName'),
             LastName: kb.observable(cust, 'LastName'),
             SalesOrderHeaders: kb.collectionObservable(orders)
           }
  return cvm;
}