Definition files correction for TypeScript

2 posts, 0 answers
  1. Matjaž
    Matjaž avatar
    80 posts
    Member since:
    Jul 2015

    Posted 06 Aug Link to this post

    I propose a fix in TypeScript definition files from:

    class DropDownList extends kendo.ui.Widget {
     
            static fn: DropDownList;
     
            options: DropDownListOptions;
     
            dataSource: kendo.data.DataSource;
            span: JQuery;
            filterInput: JQuery;
            list: JQuery;
            ul: JQuery;
     
            element: JQuery;
            wrapper: JQuery;
     
            static extend(proto: Object): DropDownList;
     
            constructor(element: Element, options?: DropDownListOptions);
     
     
            close(): void;
            dataItem(index?: JQuery): any;
            dataItem(index?: number): any;
            destroy(): void;
            focus(): void;
            items(): any;
            enable(enable: boolean): void;
            open(): void;
            readonly(readonly: boolean): void;
            refresh(): void;
            search(word: string): void;
            select(): number;
            select(li: JQuery): void;
            select(li: number): void;
            select(li: Function): void;
            setDataSource(dataSource: kendo.data.DataSource): void;
            text(): string;
            text(text: string): void;
            toggle(toggle: boolean): void;
            value(): string;
            value(value: string): void;
     
        }

    to:

    class DataBoundWidget extends Widget
    {
        dataSource: kendo.data.DataSource;  //or where it should be
    }
    class List extends DataBoundWidget
    {
        dataItem(index?: JQuery): any;  //or where it should be     
        dataItem(index?: number): any;  //or where it should be
    }
    class Select extends List
    {
        setDataSource(dataSource: kendo.data.DataSource): void;  //or where it should be
    }
    class DropDownList extends Select
    {
     
        static fn: DropDownList;
     
        options: DropDownListOptions;
     
        span: JQuery;
        filterInput: JQuery;
        list: JQuery;
        ul: JQuery;
     
        element: JQuery;
        wrapper: JQuery;
     
        static extend(proto: Object): DropDownList;
     
        constructor(element: Element, options?: DropDownListOptions);
     
     
        close(): void;
        destroy(): void;
        focus(): void;
        items(): any;
        enable(enable: boolean): void;
        open(): void;
        readonly(readonly: boolean): void;
        refresh(): void;
        search(word: string): void;
        select(): number;
        select(li: JQuery): void;
        select(li: number): void;
        select(li: Function): void;
        text(): string;
        text(text: string): void;
        toggle(toggle: boolean): void;
        value(): string;
        value(value: string): void;
     
    }

    This should make sense, since all widgets does not inherits from kendo.ui.widget as your kendo.all.d.ts file defines.

    I need a type for variable that lists all widgets that implements dataSource property. I don't want to write:

    function myFunction(implementDataSource: kendo.ui.ListView | kendo.ui.DropDownList | kendo.ui.ComboBox | kendo.ui.Grid | kendo.ui...)
    {
        implementsDataSource.dataSource.data(something);
    }

  2. Stefan
    Admin
    Stefan avatar
    264 posts

    Posted 10 Aug Link to this post

    Hello Matjaž,

    Thank you for the suggestion. I forwarded it to our developers' team for evaluation.

    I will also appreciate if you submit a feature request in our UserVoice portal. This will help us get a better idea how popular and desired this change is. Thank you.

    http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback

    Regards,
    Stefan
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
Back to Top