TypeScript definition file problems

6 posts, 0 answers
  1. Jaap
    Jaap avatar
    96 posts
    Member since:
    Oct 2012

    Posted 27 Mar 2013 Link to this post

    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

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 27 Mar 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Jaap
    Jaap avatar
    96 posts
    Member since:
    Oct 2012

    Posted 27 Mar 2013 Link to this post

    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

     

  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 27 Mar 2013 Link to this post

    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!
  6. Aaron
    Aaron avatar
    1 posts
    Member since:
    Jan 2014

    Posted 14 Feb 2015 in reply to Atanas Korchev Link to this post

    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?
  7. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 16 Feb 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready