12 Answers, 1 is accepted
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.
Atanas Korchev
Telerik
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;
Michael G. Schneider
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.
Atanas Korchev
Telerik
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
});
Writing the above code worked with "var binders: Object" but of course does not with "module binders { }".
Michael G. Schneider
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
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
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.
Atanas Korchev
Telerik
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
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
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
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.
Atanas Korchev
Telerik
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