returning viewConfig to webix.ui

edited May 2019 in Technical questions

Writting project using Typescript, I faced that problem. (MVC based)

export default function VComponent(): any {
    return {
        view:"datatable",
        container: "App-container",
        columns:[
            { id:"rank",    header:"",              width:50},
            { id:"title",   header:"Film title",    width:200},
            { id:"year",    header:"Released",      width:80},
            { id:"votes",   header:"Votes",         width:100}
        ],
        data: [
            { id:1, title:"The Shawshank Redemption", year:1994, votes:678790, rank:1},
            { id:2, title:"The Godfather", year:1972, votes:511495, rank:2}
        ]
    }
}

trying to call it this way

ComponentPublicFunction():any {
       webix.ui(VComponent())
}

The question is how can I replace ANY with exact type?
If I choose "viewConfig", I catch TS2322, seems this type doesn't contain colums or data.

As I see webix.ui can take some config. What config it is?

Tagged:

Comments

  • you can use webix.ui.datatableConfig, or you can omit type definition and the type implicitly will be as is.

  • edited May 2019

    so I can't use config as universal type?
    coz this function may return not only datatable. Omit unacceptable coz Typescript in strict mode.
    ... maybe it should look like interface

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion