Describe a Method`s Input Parameters and Output Type exactly

Thread is closed for posting
47 posts, 2 answers
  1. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 17 Jun 2013 Link to this post

    I also reported kendo.data.Binder.extend and kendo.data.Binder.fn. Why are they missing?
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 18 Jun 2013 Link to this post

    Hello Michael,

    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
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 19 Jun 2013 Link to this post

    Hello Alex,

    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"
    Michael
  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Jun 2013 Link to this post

    Hi Michael,

     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.

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 20 Jun 2013 Link to this post

    Hello Atanas,

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

    Michael G. Schneider
  7. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 20 Jun 2013 Link to this post

    Hello Atanas, thanks a lot for the answer. Would you please check kendo.data.Binder.fn.init, which is marked as an error. Michael G. Schneider P.S. Again "Invalid Post Content" on multiline posts.
  8. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Jun 2013 Link to this post

    Hi Michael,

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

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  9. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 20 Jun 2013 Link to this post

    Hello Atanas,

    "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
  10. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Jun 2013 Link to this post

    Hello,

     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
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  11. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 20 Jun 2013 Link to this post

    Hello Atanas,

    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.
    }
    So, if "kendo.data.Binder.fn.init" is to be valid, then "class Binder" must contain a method "init". It does not contain it directly, so it must be part of "class Class", which is definied as... 
    class Class {
       static fn: Class;
       static extend(prototype: Object): Class;
    }
    Also there seems to be no "init". Or do I overlook the obvious?

    Michael G. Schneider
  12. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Jun 2013 Link to this post

    Hi Michael,

     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"
        })
    });


    <div id="content" data-bind="custom: value"></div>

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  13. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 20 Jun 2013 Link to this post

    Hello Atanas,
    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
  14. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 20 Jun 2013 Link to this post

    Hello Atanas, 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  P.S. the error "Invalid Post Content" kills any fun in using the forum.
  15. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Jun 2013 Link to this post

    Hi Michael,

     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)

    Regards,
    Atanas Korchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  16. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 20 Jun 2013 Link to this post

    Hello Atanas,

    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
  17. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 20 Jun 2013 Link to this post

    Hello Atanas,

    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
  18. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Jun 2013 Link to this post

    Hello,

     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
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
Kendo UI is VS 2017 Ready