Argument type {transport: {read: (function(any): undefined)}} is not assignable to parameter type DataSourceOptions

10 posts, 0 answers
  1. Mike
    Mike avatar
    33 posts
    Member since:
    Jul 2012

    Posted 09 Dec 2015 Link to this post

    I'm currently using Typescript and the latest kendo type definition (and WebStorm as my IDE).

    I am using the DataSource as illustrated in the second example of the Read section at this link: 

        http://docs.telerik.com/kendo-ui/framework/datasource/crud

    where read is set to be a function.

    Everything compiles fine and works BUT my editor is not able to resolve this overloaded version based on the kendo ui type definition. 

     How can I get an updated version of the definition that contains this overload OR how can I resolve this issue?

    I've attached a screenshot demonstrating the error.

      

     

     

     

     

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 12 Dec 2015 Link to this post

    Hello Mike,

     

    I have just tested this with the latest typescript definitions and it worked correctly. Please make sure that you are using the latest definitions in your project.

    Regards,
    Kiril Nikolov
    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. Mike
    Mike avatar
    33 posts
    Member since:
    Jul 2012

    Posted 14 Dec 2015 in reply to Kiril Nikolov Link to this post

    Did you test it with assigning a function or with the DataSourceTransportRead object? I'm using the d.ts that came with the version of kendo I am using (Q3 2015) and I don't see where the d.ts defines read to accept a function. It seems to only accept a DataSourceTransportRead object.
  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 16 Dec 2015 Link to this post

    Hello Mike,

     

    I have tested that as well. I am using the 2015.3.1214 version. Can you please download it from your account and try it?

     

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Mike
    Mike avatar
    33 posts
    Member since:
    Jul 2012

    Posted 18 Feb in reply to Kiril Nikolov Link to this post

    I am now upgraded my project to use Q1 2016 of Kendo UI and I am still getting the issue. Find attached screenshots of following the the object chain.

    The screenshots are named numerically and should be viewed in numeric order.

    Assigning a function to Read as I am doing in the first screenshot above works and transpiles BUT I receive an error from my IDE (WebStorm) as can be seen in screenshot #1. WebStorm however appears to be correct that ‘read’ doesn’t evaluate to a function but rather an object that extends JQueryAjaxSettings. How can I make the error go away?

  7. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 22 Feb Link to this post

    Hi Mike,

    I am not sure what is causing this error in your IDE as I am not able to reproduce it inside Visual Studio (I do not have WebStorm available here). Can you reproduce the same error in a VS solution or other IDE?

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. Mike
    Mike avatar
    33 posts
    Member since:
    Jul 2012

    Posted 22 Feb in reply to Kiril Nikolov Link to this post

    I've shown the logic to trace through the definitions and I think WebStorm is correct. The Telerik documentation says the read of DataSourceTransport may be a object, function or string (see attached pic). The kendo type definition says object only (DataSourceTransportRead). When I change the defintion of 'read' to be 'read?: DataSourceTransportRead|Function|string' the error goes away. I think Telerik should update their type definition file. Or please tell me why they shouldn't?
  9. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 23 Feb Link to this post

    Hi Mike,

    The problem is that I cannot reproduce the same issue locally and therefore see what is causing the issue, as the documentation is correct the read supports a function as well as object or a string. When I use your configuration locally I do not get the same error.

    We will further investigate the issue and if something comes up - or you send us a sample where we can reproduce the issue - it will really help.

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  10. Mike
    Mike avatar
    33 posts
    Member since:
    Jul 2012

    Posted 23 Feb in reply to Kiril Nikolov Link to this post

    Yes the Telerik documentation appears to be accurate BUT the typescript definition is not. If you actually look at my screenshot #4 you can see the read property is expected to be of type DataSourceTransportRead which is an object and is not a function or string as the documentation says it can be. The solution as I have mentioned is to change this property to be a union type of DataSourceTransportRead and Function and string. Why is this so confusing?
  11. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 25 Feb Link to this post

    Hello Mike,

    I am not able to reproduce the problem locally, please see the attached screenshot showing the working code. I believe it is an issue with your editor and its settings.

    Regards,
    Kiril Nikolov
    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