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

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

9 Answers 333 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 09 Dec 2015, 01:52 PM

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.

  

 

 

 

 

9 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 12 Dec 2015, 08:10 AM

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!
 
0
Mike
Top achievements
Rank 1
answered on 14 Dec 2015, 12:52 PM
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.
0
Kiril Nikolov
Telerik team
answered on 16 Dec 2015, 08:05 AM

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!
 
0
Mike
Top achievements
Rank 1
answered on 18 Feb 2016, 07:01 PM

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?

0
Kiril Nikolov
Telerik team
answered on 22 Feb 2016, 08:51 AM
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!
 
0
Mike
Top achievements
Rank 1
answered on 22 Feb 2016, 05:55 PM
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?
0
Kiril Nikolov
Telerik team
answered on 23 Feb 2016, 08:13 AM
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!
 
0
Mike
Top achievements
Rank 1
answered on 23 Feb 2016, 11:26 PM
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?
0
Kiril Nikolov
Telerik team
answered on 25 Feb 2016, 08:33 AM
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!
 
Tags
Data Source
Asked by
Mike
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Mike
Top achievements
Rank 1
Share this question
or