Typescript & kendo.mobile.application

9 posts, 0 answers
  1. Sean
    Sean avatar
    79 posts
    Member since:
    May 2007

    Posted 11 Apr Link to this post

    I am starting a new project using the Kendo Mobile controls (release 2016 Q1 SP2), and I am using TypeScript.  When I attempt to instantiate my kendo.mobile.application, I am getting errors from TypeScript and the issue appears to be that the type definition file does not contain the correct definition.

    Here is my simple TypeScript code:

    var app = new kendo.mobile.Application(document.body,
        {
            transition: 'slide',
            skin: 'nova',
            init: function () {
                //don't do this for android, causes issues with scrollView and swiping
                kendo.UserEvents.defaultThreshold(kendo.support.mobileOS.device === 'android' ? 0 : 20);
        }
    });

    This code works fine when I run it in JavaScript, but after trying it in TypeScript and I getting compiler errors - it's complaining about the "skin" and "init" options.  The errors are shown in the attached images (skin.png and init.png).  The skin configuration option is shown in the Kendo docs (http://docs.telerik.com/kendo-ui/api/javascript/mobile/application#configuration-skin), so is it just a matter of the type definition file being incorrect?  Or is there something else I need to do?

    Also, looking over the type definition file, it appears that the ApplicationOptions parameter used when initializing the application object is missing quite a few items that are listed in the Kendo documentation (http://docs.telerik.com/kendo-ui/api/javascript/mobile/application) - things like browserHistory, hashBang, modelScope, useNativeScrolling, etc. So this seems like more than just a minor oversight, which leads me to my other question...is TypeScript fully supported for Kendo Mobile?  Just want to make sure I'm going down the "sanctioned" path before I get too far into my project.

  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 13 Apr Link to this post

    Hi,

    a typescript with Kendo UI mobile application is not something we have seen very often, yet not unheard of. My guess is that people are editing the d.ts file and don't contact us about the missing pieces - we will add them on our side.

    This being said, Kendo UI itself is not written in TypeScript, which leads to two problems people commonly face: incomplete or wrong definitions, or APIs which are a bit inconvenient and do not feel right when utilized in TypeScript. To give you an example, many widget configuration options accept string, number, object and a function, which is, well, most of the types one can come up with. This somewhat defeats the purpose of the language features.
     

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Sean
    Sean avatar
    79 posts
    Member since:
    May 2007

    Posted 13 Apr in reply to Petyo Link to this post

    Thanks for the reply Petyo.  Manually editing the .d.ts file myself is not a viable solution, because then every time I upgrade to a newer version of the Kendo controls I would have to make those edits again.  I am glad to hear that the TypeDefinitions will be updated, when can I expect that to be included (just looking for a general timeframe)?

    As for your second point of "which leads to two problems people commonly face: incomplete or wrong definitions".  This is a big problem to me and the other developers at my organization.  Telerik touts that they integrate with TypeScript, but it sounds like there is a ways to go with this.  This is not the first time I have experienced issues with the Type Definitions.  Are there any plans to improve the TypeDefinitions files?  It seems unacceptable that there are frequently "incomplete or wrong definitions" (which I have experienced firsthand).  My company has invested a lot of development resources into TypeScript and we want to be able to leverage that with the Kendo controls as well, but problems like this make it difficult to implement.  I think the Kendo controls are great, but I just wanted to voice my concerns and hopefully this will improve in the future.

    Thanks,

    Sean

  5. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 15 Apr Link to this post

    Hi,

    the typescript definitions will be updated in our next maintenance release, which will be probably in a week or two. 

    The thing we have done so far is to automatically generate the d.ts definitions based on our documentation - however, there are parts which can't be done, due to some non-standard part. The mobile application is one of those. 

    A thing which may be worth mentioning, as typescript and angular go hand in hand these days - our upcoming Angular 2 effort will be authored in typescript, which should eliminate such mismatches and provide smoother TypeScript experience from the consumer perspective. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. John
    John avatar
    10 posts
    Member since:
    Jun 2010

    Posted 13 Sep in reply to Petyo Link to this post

    Will the angular 2 effort include the ability to create cordova hybrid apps?
  7. John
    John avatar
    10 posts
    Member since:
    Jun 2010

    Posted 13 Sep in reply to Sean Link to this post

    Sean

    How did you end up going with your app?  Im about to start to and my client doesn't want to wait for angular 2

  8. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 14 Sep Link to this post

    Hello John,

    in case you are interested in building mobile apps with Angular 2, you should definitely check NativeScript - it features significant advantages over Hybrid.

    Regards,
    Petyo
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  9. John
    John avatar
    10 posts
    Member since:
    Jun 2010

    Posted 14 Sep in reply to Petyo Link to this post

    Will the angular 2 effort include the ability to create cordova hybrid apps?
  10. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 15 Sep Link to this post

    Hi,

    No. We suggest using NativeScript instead. 

    Regards,
    Petyo
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
Back to Top
Kendo UI is VS 2017 Ready