Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ sahipro.com with your query.

TypeScript integration

vladvlad Members
Did some one tried the integration with TypeScript?
(e.g. create some project-wide libraries, that can be used from *.sah files)

Comments

  • vladvlad Members
    edited May 25
    It turned out, that it's enough to write some stubs for sahi functions to be able to integrate it with typescript e.g. in a sahi_apis.ts:

    function _click ($element:any|null, $combo?:any|null){}
    function _link(el:any|null, domRelation?:any|null){}
    function _cell(el:any|null, domRelation?:any|null){}
    function _wait(time){}


    Instead of argument types any you could try to provide some real types to enable the actual type-checking.
    All you need then is to compile yout sahi_apis.ts with tsc and to use in your TypeScript classes with Reference syntax:

    /// <reference path="../../libs/sahi_apis.ts" />
  • vladvlad Members
    It turned out, that it's enough to write some stubs for sahi functions to be able to integrate it with typescript e.g. in a sahi_apis.ts:

    function _click ($element:any|null, $combo?:any|null){}
    function _link(el:any|null, domRelation?:any|null){}
    function _cell(el:any|null, domRelation?:any|null){}
    function _wait(time){}


    Instead of argument types any you could try to provide some real types to enable the actual type-checking.
    All you need then is to compile yout sahi_apis.ts with tsc and to use in your TypeScript classes with Reference syntax:

    /// <reference path="../../libs/sahi_apis.ts" />
Sign In or Register to comment.