15 Answers, 1 is accepted
+1
Would love to see that
TypeScript is something very new and we still have no specific intentions with regard to it. Surely this language will need to prove its value and popularity (or at least its prospects and business value) before we decide to adopt it in any way.
Regards,
Dimo
the Telerik team
I am starting with TypeScript and I could very easily show a kendo Window without having to define a declaration file. Here is the code:
module SiteMaster {
// Class
export class Config {
// Instance member
run() {
var logOnParams = {
draggable: false, resizable: false, width: "300px", height: "180px",
title: "LogOn", modal: true, visible: false,
scrollable: false, actions: []
};
var logonDlg = $("#logonDialog");
if(!logonDlg.data("kendoWindow")) {
(<
any
>logonDlg).kendoWindow(logOnParams);
var kendoWindow = logonDlg.data("kendoWindow");
kendoWindow.center();
kendoWindow.open();
}
}
}
}
As you can see you have to cast to any to call the kendoWindow so that Visual Studio does not emit an error. Because a jQuery object, logonDlg does not have a method "kendoWindow".
It works Ok. But off course it would be better if Telerik generates for us a declaration file.
interface IKendoTemplate {
}
interface IKendo {
ui: any;
bind(jqueryObject: any, vm: any);
observable(obj: any): any;
data: any;
//data(widget: string): any;
template(template: string): IKendoTemplate;
render(template: IKendoTemplate, data: any): string;
}
interface JQuery {
kendoValidator(opts?: any): IKendo;
kendoMenu(opts?: any): IKendo;
kendoDropDownList(opts?: any): IKendo;
}
declare
var
kendo: IKendo;
Looks very promising to me...
Please create a new user voice item in our feedback portal.
Regards,Atanas Korchev
the Telerik team
You can file your vote for TypeScript support in this User Voice item, to affect its priority. There is also a sample solution posted by Jaap Mosselman in the comments which you may ponder in the meantime.
Kind regards,
Sebastian
the Telerik team
thanks - dave
I found typescript\kenod.all.d.ts in the zip, I assume that is it. Do you guys have any instructions, caveats, etc. about using this? If so, can you provide a link to them?
thanks - dave
Yup, that's it. It's just a definition file, same as the ones you can find on Nuget for jQuery, etc. Same as those, in Visual Studio you can just drag it into another typescript source file to create a reference and have intellisense available. Works same as JavaScript files in VS - creates this commend at the top with relative path to the definition file (*.d.ts are all TypeScript definitions)
/// <reference path="../typings/jquery/jquery.d.ts" />
/// <reference path="../typings/kendo.all.d.ts" />
Hopefully, parts are still buggy I've found. Each TypeScript version seems to break something, but fix something else. The Kendo definitions are pretty complete - think there's only been one or two points where I had to change their supplied definition file (forget where, but something declared as a {}, switched to 'any' so TypeScript would allow me to could extend it).