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

TypeScript definition file problems

5 Answers 316 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jaap
Top achievements
Rank 2
Jaap asked on 27 Mar 2013, 12:55 PM
Hello,
Just upgraded my project to KendoUI 2013.1.319. I used already TypeScript in my project and create a type definition file for KendoUI (which I posted on Uservoice). Thanks for the work done!
I am now using your version of the type definitions, but found some problems.
I attached a zip file with my version and the original 319 version, so you can compare easily.

Some of the problems:
  • Missing overloads of functions
  • Missing utility functions
  • Missing some fields on classes
  • Missing Popup and Query classes

Sometimes I added also fields and functions with names starting with underscore.
I know these are considered to be private.
But I needed them in some cases when I derived a class from a Kendo class. So I use them as if they are 'protected' (as we would call it in C#). It is not very elegant to add them to the type definition. Any thoughts how to solve that?
BTW: my additions are far from complete. Sometimes I just added a field with type any to make it just work. Of course I expect you will work them out :-)

Regards, Jaap

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 Mar 2013, 02:25 PM
Hello Jaap,

 The Kendo UI TypeScript definition file will include only API which is public and documented in the API reference documentation.

 If you need undocumented or private API you can modify our file as you see fit.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jaap
Top achievements
Rank 2
answered on 27 Mar 2013, 03:05 PM
for private API I can imagine that.
But what about public but undocumented API?
There are very nice functions and classes available which are not documented.
Is it not supported to use them?
E.g. the Query class is very useful when you have a collection of objects and you want to filter or sort them.

Here is my list of problems in the definition file of the documented API:
  1. kendo.Culture() does not return a string but a Culture object
  2. kendo.data.binders is not documented but should be because you need it when you add a custom binder, see example of http://docs.kendoui.com/api/framework/binder
  3. kendo.data.Binder class needs fields bindings and element, else you can't create a custom binder as shown in above mentioned example.
  4. kendo.ui.plugin function is documented but not in the definition file
  5. kendo.ui.Widget class needs a constructor else you can't derived a new widget from it.
  6. the enable parameter of Upload.enable() should be optional. The documentation shows you can call it without parameter.
  7. kendo.dataViz.registerTheme is not documented, but AFAIK the way to add custom themes

 

0
Atanas Korchev
Telerik team
answered on 27 Mar 2013, 03:37 PM
Hi Jaap,

 As soon as we document those classes and methods they will appear in the TypeScript definition file. You can expect this to happen for our next official release.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Aaron
Top achievements
Rank 1
answered on 14 Feb 2015, 02:42 PM
I'm still having a problem with creating a custom binding - kendo.data.binders - 'binders' does not exist on value of type 'typeof kendo.data'.

Is there an update for the typescript definition file coming regarding this?  What is the recommended workaround?
0
Atanas Korchev
Telerik team
answered on 16 Feb 2015, 02:38 PM
Hello Aaron,

Here is an example which shows how to create a custom MVVM binder:

/// <reference path="jquery.d.ts" />
/// <reference path="kendo.all.d.ts" />
 
module kendo.data.binders {
    export class custom extends kendo.data.Binder {
        refresh() {
            var value = this.bindings["custom"].get();
 
            $(this.element).html(value);
        }
    }
}
 
$(document).ready(function () {
    var viewModel = kendo.observable({
        model: "Custom binder"
    });
 
    kendo.bind(document.body, viewModel);
});

And here is the HTML:

  <div id="content" data-bind="custom:model"></div>

I have attached a runnable sample project for your reference.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
Jaap
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Jaap
Top achievements
Rank 2
Aaron
Top achievements
Rank 1
Share this question
or