this is a new post, describing the problem that we started to talk about in the "definition file for Typescript" thread.
Create a simple Typescript file test1.ts and compile for AMD
export
var
NAME =
"mike"
;
/// <reference path="kendo.all.d.ts" />
module kendo.data.binders {
export class custom extends Binder {
constructor(element: Element, bindings: { [key: string]: Binding; }, options?: any) {
super
(element, bindings, options);
}
}
/// <reference path="../dts/kendo.all.d.ts" />
import T1 = module(
"test1"
);
module kendo.data.binders {
export class custom extends Binder {
constructor(element: Element, bindings: { [key: string]: Binding; }, options?: any) {
super
(element, bindings, options);
}
}
}
Michael G. Schneider
9 Answers, 1 is accepted
Are you sure the path to the definition file is correct? This looks like a wrong path issue. TypeScript probably can't find anything from the kendo namespace because it can't load the file. In any case sending us a complete project would help us pinpoint the problem.
Regards,Atanas Korchev
Telerik

the "../dts/" has been a copy/paste error. Of course, also in test3.ts there is the correct reference to your definition file. But I will prepare a complete project and send it later.
Michael G. Schneider

here is a sample project showing the problems. If you have Web Essentials installed, then saving test3.ts will show the errors. The same will happen when compiling on the command line.
Thanks a lot in advance.
Michael G. Schneider

Indeed there seems to be some issue when the import statement is used. For some reason one can no longer extend existing modules (such as kendo.data.binders). TypeScript treats them as a completely new module. I was able to reproduce the same behave with a very simple setup:
kendo.all.d.ts:
declare module foo {
export class bar {
}
}
declare module foo.bar {
}
test3.ts:
/// <reference path="kendo.all.d.ts" />
module foo {
class baz extends bar { // Could not find symbol "bar"
}
}
import T1 = module("test1"); // removing this line solves the problem
http://stackoverflow.com/questions/14311801/typescript-internal-module-cannot-be-imported-unexpected-behavior
http://stackoverflow.com/questions/15910131/using-import-breaks-extending-internal-modules
Regards,
Atanas Korchev
Telerik

thanks a lot for the answer. This situation is not new with v0.9. So even with v0.8 it was impossible to create binders by using inheritance, if AMD was part of the solution.
So it seems as if creating a binding (probably also widgets itsself) is best not done by inheritance, but by the usual Javascript technique.
This is something which brings me back to the other thread, asking for a change in the definition file, so "kendo.data.Binder.fn.init" can be coded.
Michael G. Schneider
Does manually adding the init statement to the kendo definition file help? It is the same as the "constructor".
Regards,Atanas Korchev
Telerik

yes, including a
init(element, bindings, options): void;
Michael G. Schneider
I've asked a question on stackoverflow about why this error occurs (looks like a TypeScript bug to me).
We will patch our definitions to include the init method as well as the constructor. This would be available in the next official release.
Atanas Korchev
Telerik