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

Kendo 2013.2: Typescript Definition Problems

12 Answers 151 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
mgs
Top achievements
Rank 1
mgs asked on 18 Jul 2013, 04:39 PM
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

12 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 19 Jul 2013, 06:43 AM
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!
0
mgs
Top achievements
Rank 1
answered on 19 Jul 2013, 07:27 AM
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
0
Atanas Korchev
Telerik team
answered on 19 Jul 2013, 09:09 AM
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!
0
mgs
Top achievements
Rank 1
answered on 19 Jul 2013, 09:22 AM
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
0
Atanas Korchev
Telerik team
answered on 19 Jul 2013, 10:24 AM
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!
0
mgs
Top achievements
Rank 1
answered on 19 Jul 2013, 10:39 AM
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
0
Atanas Korchev
Telerik team
answered on 19 Jul 2013, 02:12 PM
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!
0
mgs
Top achievements
Rank 1
answered on 19 Jul 2013, 02:35 PM
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
0
Atanas Korchev
Telerik team
answered on 22 Jul 2013, 08:04 AM
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!
0
mgs
Top achievements
Rank 1
answered on 08 Aug 2013, 10:09 AM
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
0
Atanas Korchev
Telerik team
answered on 08 Aug 2013, 10:25 AM
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!
0
mgs
Top achievements
Rank 1
answered on 08 Aug 2013, 10:31 AM
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
Tags
General Discussions
Asked by
mgs
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
mgs
Top achievements
Rank 1
Share this question
or