This is a migrated thread and some comments may be shown as answers.

Definition files correction for TypeScript

1 Answer 69 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Seyfor
Top achievements
Rank 1
Seyfor asked on 06 Aug 2016, 02:19 PM

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

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 10 Aug 2016, 07:50 AM
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.
 
Tags
General Discussions
Asked by
Seyfor
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or