This is a migrated thread and some comments may be shown as answers.

Typescript & kendo.mobile.application

8 Answers 198 Views
Application
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 11 Apr 2016, 07:30 PM

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.

8 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 13 Apr 2016, 12:13 PM
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!
 
0
Sean
Top achievements
Rank 1
answered on 13 Apr 2016, 07:28 PM

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

0
Petyo
Telerik team
answered on 15 Apr 2016, 10:19 AM
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!
 
0
John
Top achievements
Rank 1
answered on 13 Sep 2016, 07:33 AM
Will the angular 2 effort include the ability to create cordova hybrid apps?
0
John
Top achievements
Rank 1
answered on 13 Sep 2016, 07:44 AM

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

0
Petyo
Telerik team
answered on 14 Sep 2016, 09:21 AM
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.
 
0
John
Top achievements
Rank 1
answered on 14 Sep 2016, 11:16 AM
Will the angular 2 effort include the ability to create cordova hybrid apps?
0
Petyo
Telerik team
answered on 15 Sep 2016, 10:06 AM
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.
 
Tags
Application
Asked by
Sean
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Sean
Top achievements
Rank 1
John
Top achievements
Rank 1
Share this question
or