Let me make an example. Look at TreeView expand method. The parameter is described as "nodes Selector". What does this mean? Is it a jQuery selector such as "#tree" or "div.tree"? Or is this an DOM object or maybe a jQuery object? The samples show that probably both a selector or a DOM object can be given to the method. If this is so, I would like to read it in the documentation.
A user might also try to find out about method parameters by looking at the TypeScript definition. There he will find...
class TreeView extends kendo.ui.Widget {
expand(nodes: string): void;
}
Michael G. Schneider
46 Answers, 1 is accepted
The parameter of the expand/collapse method can be a string, a DOM element, or a jQuery object, because it is internally wrapped in a jQuery object (roughly, parameter = $(parameter)). The documentation will be updated shortly with the proper signature, and the TypeScript definitions have been patched, as noted in the other thread you started.
Regards,Alex Gyoshev
the Telerik team

thanks a lot for the answer,
Michael G. Schneiderf

please look at TreeView.parent.
- The parameter is described as "Element". As the sample shows, it can also be a "jQuery".
- Moreover, from reading the documentation how can I know what comes back? Is it a DOM Element or is it a jQuery Element?
Looking at the TypeScript definition is no real help. Neither the parameter nor the return type seems to be correct.
class TreeView extends kendo.ui.Widget {
parent(node: Element): void;
}
Michael G. Schneider
There have been some discrepancies in the API documentation of the TreeView, which we now fixed. Element always denotes a DOM element, and jQuery denotes a jQuery object. Such shortcomings in the TypeScript will be addressed with each internal build -- but we appreciate every feedback we get, so you are encouraged to let us know if you stumble upon such problems. Your Telerik points have been updated for this bug report.
Regards,Alex Gyoshev
the Telerik team

if a method has several signatures, e.g. accepting a "selector string" or a "DOM element" or a "jQuery element", I suggest you do not describe the parameter as "any", but you use overloading instead.
Intellisense would greatly benefit from it.
Michael G. Schneider
Thank you for the feedback. Because implementing this requires a non-trivial effort, we have logged it and will consider it for future releases.
Regards,Alex Gyoshev
the Telerik team

thanks a lot for the answer and the points. You might include overloading widget by widget. It need not be done all at once.
Out of curiosity: how do you create the definition file? Is it written by hand? Do you generate it out of some database, containing all classes and methods? Maybe by scanning the comments in the source code?
Michael G. Schneider
Some of the file is written by hand; most of the definitions are generated from the public API. The methods in question are generated, and creating all correct signatures is the non-trivial task that I mentioned (i.e. taking into account the different types, as well as optional parameters).
All the best,Alex Gyoshev
the Telerik team

the following definitions are missing
- kendo.Class
- kendo.Observable inheriting from kendo.Class
- kendo.ui.plugin
- DataSource.create
Michael G. Schneider
We have added the Class class, as well as the inheritance. Both the kendo.ui.plugin and the DataSource.create methods are not documented and will not be added to the TypeScript definitions until they are.
Regards,Alex Gyoshev
the Telerik team

thanks a lot for the answer. Would you please elaborate on...
- You say that you included the "Class" and the inheritance. Where can I download that file? Or is it for internal use only? I very much appreciated, if the file were always available in its most recent version.
- I do not understand this "not documented" statement. At least kendo.ui.plugin is documented (please see kendo.ui.plugin).
- Aren't those two methods officially supported? Shouldn't they be used? After all, they are needed for plugin development.
I am sorry to have mislead you. Both methods are documented, and have been added to the attached TS file.
All the best,Alex Gyoshev
the Telerik team

thanks a lot for the answer and the definition file.
One more suggestion: the static method DataSource.create is mentioned in blog entries. However, it is not documented in API Reference. At least, I never saw it somewhere.
Michael G. Schneider
Yes, that mislead me that it is not documented. It can be found in both blog posts and the getting started help topic; it will be documented shortly.
All the best,Alex Gyoshev
the Telerik team

the methods "static fn" and "static extend" should be added to "kendo.Observable" and "kendo.ui.Widget".
I am not sure whether the static methods should automatically be inherited into the two classes per Typescript language definition. Anyway, in reality they are not inherited. Including the definitions into Observable and Widget fixes this.
Even if inheriting the static methods would work, the return type should not be "Object". Calling "init" on "fn" is impossible that way.
Moreover, the options parameter in the Kendo.View's constructor is missing.
Michael G. Schneider
Indeed, static members are not inherited in TypeScript. I'm attaching the latest TS definitions.
Greetings,Alex Gyoshev
the Telerik team

thanks a lot for the answer and the definition file. I looked at the options for the kendo.View constructor.
- It has several properties (e.g. title, reload, defaultTransition, etc.) which are not described in the documentation.
- The documentation describes the properties "tagName" and "wrap", which are not part of the ViewOptions interface.
Moreover, the kendo.View constructor has an "Element" parameter in this definition file. However, a string can be passed as the first parameter.
Moreover, calling "widget.fn.init" is not possible. Method "init" is missing.
Moreover, using keno.ui.plugin is not possible due to its first parameter "widget: Function". Type 'Widget' is missing property 'prototype' from type 'Function'.
Michael G. Schneider
Thank you for your feedback. You can find attached the updated definitions file.
All the best,Alex Gyoshev
the Telerik team

thanks a lot. I did a quick check and all problems were gone.
Michael G. Schneider

- kendo.ui.ListViewOptions.selectable isn't a string, it is a bool
- kendo.ui.GridViewOptions.selectable is declared as any, but might be declared bool
The Grid selectable option can be either a bool or a string ("multiple, row"). The same is valid for the ListView selectable option, so both need to be of any type. The attached definitions address this.
All the best,Alex Gyoshev
the Telerik team

- kendo.ui.WindowOptions.height currently is a "number", shouldn't that be "string" or even "any"
- same for maxHeight, minHeight, width, ...
- kendo.fx seems to be missing
- shouldn't kendo.ui.WindowAnimationClose contain a "reverse"
- same for WindowAnimationOpen
Regarding WindowAnimationClose, the API Reference does not mention a "reverse".
- kendo.ui.WindowOptions.height currently is a "number", shouldn't that be "string" or even "any", same for maxHeight, minHeight, width, ...
This is valid for width and height. The min/maxWidth/Height support only pixel values (i.e. numbers). - kendo.fx seems to be missing
Added. - shouldn't kendo.ui.WindowAnimationClose/Open contain a "reverse"
Added.
Alex Gyoshev
the Telerik team

the following seems to be missing.
- kendo.data.binders
- kendo.data.Binder.extend
- kendo.data.Binder.fn

the following seems to be missing.
kendo.data.binders
kendo.data.Binder.extend
kendo.data.Binder.fn
P.S.: I initally created this post with an unordered list. When trying to post, the message "Invalid post content" appeared in red under the input textarea.
P.S.P.S.: Yesterday the previous post with the bulleted list was not shown. It appeared today.
Michael G. Schneider
Thanks for reporting these -- they have been added.
Regards,Alex Gyoshev
Telerik

thanks a lot for the answer. Maybe I am doing something wrong. I also reported...
kendo.data.Binder.extend
kendo.data.Binder.fn
Shouldn't they also be inserted into the file?
Michael G. Schneider
P.S.: Once again the "invalid post content" message appeared, when I posted this text with a bulleted list. Is this a problem on my side or is it a general problem with the forum?



I am sorry, I just inherited the Binder class from kendo.Class. The members should be present in the attached file.
Thank you for reporting the problem with the forums, we have notified the developers who work on this functionality.
Regards,Alex Gyoshev
Telerik

With Typescript v0.9 some change have to be made to the definition file...
- error TS1046: 'declare' modifier required for top level element
for example "module kendo" - error TS1038: 'declare' modifier not allowed for code already in an ambient context.
for example "declare function bind" inside "module kendo"
There is already a thread about this TypeScript 0.9 backwards compatibility issue: http://www.kendoui.com/forums/framework/general-discussions/typescript-0-9-0-support.aspx
I am closing this one because it digressed from the original topic. Feel free to open new ones if you need to report anything else.
Atanas Korchev
Telerik

thanks a lot for the answer. Would you please check kendo.data.Binder.fn.init, which is marked as an error.
Michael G. Schneider

I am not sure what "check kendo.data.Binder.fn.init, which is marked as an error" means. Please elaborate.
Regards,Atanas Korchev
Telerik

"kendo.data.Binder.fn.init.call(this, element, bindings, options)" is typically done in "init" when extending "kendo.data.Binder".
However, with your definition file the above call is not possible, because the property "init" does not exist on value of type "Binder".
Michael G. Schneider
That definition wasn't changed as part of the 0.9 compatibility update. Perhaps this is another breaking change in TypeScript 0.9. You can try using TypeScript inheritance instead.
Regards,Atanas Korchev
Telerik

I am not sure it has anything to do with Typescript v0.9. Inside the definition file we can find...
class Binder extends Class {
static fn: Binder;
etc.
}
class Class {
static fn: Class;
static extend(prototype: Object): Class;
}
Michael G. Schneider
I repeat that there is no difference between the latest and previous definitions files when it comes to the fn property. You can also use "prototype" instead of it. They are virtually the same. However I still recommend using TypeScript inheritance. Here is a demo:
module kendo.data.binders
{
export class custom extends kendo.data.Binder
{
constructor(element: Element, bindings: { [key: string]: Binding; }, options?: any)
{
super(element, bindings, options);
}
refresh() {
var value = this.bindings["custom"].get();
$(this.element).text(value);
}
}
}
$(function () {
kendo.bind(document.body, {
value: "custom value"
})
});
Atanas Korchev
Telerik

thanks a lot for the answer.
- I do know that the definition file for v0.9.0 does not change anything regarding fn.
- The problem with fn has already existed before.
- As you can see with the previous discussion with Alex, several methods regarding "Binder" had been missing.
- Using "prototype" does not change anything. It also brings the error.
- Using Typescript inheritance might be an option later. However, today I just want my existing code to be compiled.
Of course I already made my code compilable, by simply changing...
class Binder extends Class {
static fn: any;
// etc.
}
However, I suggest you also change something in the definition file for solving the problem.
Michael G. Schneider

Using TypeScript inheritance is the supported approach. The init method is replaced with the TypeScript constructor. If you for some reason don't want to use TypeScript constructors you can define the init method manually in the definition file:
init(element: Element, bindings: { [key: string]: Binding; }, options?: any)
Atanas Korchev
Telerik

sorry, we obviously have a different opinion. I think that the definition file should be written, so any valid Javascript can be inserted into a Typescript file. If this is not so, migration will not be as easy.
Michael G. Schneider

I played with your code using inheritance for binder creation. I have problems making it compile, if it is used in combination with external modules. Just take your code, put it in some Typescript file, add a reference to kendo.all.d.ts, and it will compile fine.
Now, add a module import into the file, and try to compile again. Now, there are several "does not exist" errors.
Michael G. Schneider
I cannot reproduce this problem. Since this thread is no longer related to the original subject I am going to close it. Feel free to open a new one and provide an example showing that TypeScript inheritance doesn't work.
Regards,Atanas Korchev
Telerik