Kendo 2013.2: Typescript Definition Problems

13 posts, 0 answers
  1. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 18 Jul 2013 Link to this post

    With Kendo 2013.2 and Typescript 0.9
    • On line 401 there is "module binders { };" which shouldn't be there. In 703 there was a "var binders: Object;" which was ok.
    Michael G. Schneider
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 19 Jul 2013 Link to this post

    Hi,

     We are aware of this issue and have already fixed it. Removing the colon solves the problem:

    module binders {}

    The next internal build will include the fix.

    Regards,
    Atanas Korchev
    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. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 19 Jul 2013 Link to this post

    Hello Atanas,

    thanks a lot for the answer. I think that removing the colon is not the way to go.

    We are talking about "kendo.data.binders". This is not a module but it is an object instead, isnt't it? When simply removing the colon, please try
    var _oKendoBinders = kendo.data.binders;
    This should create a variable pointing to the binders. However, with "module binders { }" inside the definition file this is not possible.

    Michael G. Schneider
  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 19 Jul 2013 Link to this post

    Hi Michael,

     kendo.data.binders is used as a module (namespace). It contains only other binders and no methods or fields. So it is not an object in TypeScript terms - it is more like a module. The same goes for kendo.ui, kendo.data etc.

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 19 Jul 2013 Link to this post

    Hello Atanas,

    thanks a lot for the answer. Sorry for still bothering you with that subject. If "binders" is really just a namespace, then I did not understand that subject correctly.

    When creating a custom binder in the past, I have always written something like
    kendo.data.binders["mybinder"] = kendo.data.Binder.extend({
       // code for init and refresh etc
    });
    So I thought that "binders" were actually an object, not a namespace.

    Writing the above code worked with "var binders: Object" but of course does not with "module binders { }".

    Michael G. Schneider
  7. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 19 Jul 2013 Link to this post

    Hello Michael,

     This code is taken from JavaScript and indeed will work if binders is an object. However it is not really that - it is a namespace in TypeScript terms. We recommend using TypeScript inheritance when using TypeScript and the extend method when using JavaScript. I believe we have discussed this in a previous forum thread. We cannot make kendo.data.binders an object because then it can't be used as a TypeScript module which it is supposed to.

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  8. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 19 Jul 2013 Link to this post

    Hello Atanas,

    thanks a lot for the answer. Yes we discussed "Binders vs. Inheritance" in this thread.

    http://www.kendoui.com/forums/kendo-ui-framework/general-discussions/typescript-inheritance-for-binders.aspx

    The result from that discussion was that it is impossible to create binders by using inheritance, if AMD is part of the solution. So at least for me, "binders" has to be an object. Or has something changed since our discussion?

    What would not work, if you inserted  "var binders: Object" into the definition file?

    Michael G. Schneider
  9. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 19 Jul 2013 Link to this post

    Hi Michael,

    As far as I know one cannot have a variable with the same name as a module in TypeScript. This is why we can't have both. Let me know if this is incorrect. 

    What changed is that other customers complained that kendo.data.binders was not a module but an object. This fact prevented using TypeScript inheritance which people seem to prefer than the extend method.

    The problem with AMD modules seems to be a TypeScript bug which will hopefully get fixed at some point. At least this was the answer I got when I asked on stackoverflow: http://stackoverflow.com/questions/17215373/why-does-importing-a-typescript-module-disallow-existing-module-extension

    If you must continue using binders as an object you should modify the Kendo UI TypeScript definition file. It is not that much of a change and won't affect other customers.

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  10. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 19 Jul 2013 Link to this post

    Hello Atanas,

    thanks a lot for the answer. I cannot say much about the answer that you received on stackoverflow. If you think that it is a bug, then report it on https://typescript.codeplex.com/WorkItem/Create. Please post the link to the bug report here, so I can follow it, too.

    Michael G. Schneider
  11. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 22 Jul 2013 Link to this post

    Hello,

     I've just reported the issue. You can track it here: https://typescript.codeplex.com/workitem/1376. Hopefully it would get some attention and be fixed.

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  12. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 08 Aug 2013 Link to this post

    Hello Atanas,

    I appreciated, if the change from "bool" to "boolean" were made. In Kendo 801 you still coded "bool". In Typescript 091 "bool" is flagged as an error.

    What do you think about the answer to your report on the Typescript bug tracker?

    Michael G. Schneider
  13. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 08 Aug 2013 Link to this post

    Hello Michael,

     I find the reply very reasonable:

    "You'll need to extend the module in its own file that is also an internal module (ie doesn't contain import or export). Then you can reference/import that and whatever else you need in your last file there."

     This should work in your case as well - to create the custom binder in its own internal module.

     We will fix the boolean issue with our next internal build. It is a shame TypeScript introduces a breaking change with every minor release.

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  14. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 08 Aug 2013 Link to this post

    Hello Atanas,

    thanks a lot for the answer.

    I did not see that answer at all. I looked at the bottom of the thread and the last entry was your "any workaround" question.

    Michael G. Schneider
Back to Top
Kendo UI is VS 2017 Ready