Typescript issues following example docs
See original GitHub issueI’m getting some typescript errors following the examples in the readme and can’t quite figure out what they mean or why they are happening.
I copied exactly the todosKeys
example and am getting the following errors related to specific lines
single: (id: string) => id,
Type '(id: string) => string' is not assignable to type 'FactoryProperty'.
Type '(id: string) => string' is not assignable to type 'FactoryCallback'.
Type 'string' is not assignable to type 'AnyObject'.
Type '(id: string) => string' is not assignable to type 'FactoryProperty'.
Type '(id: string) => string' is not assignable to type 'FactoryCallback'.
Type 'string' is not assignable to type 'AnyObject'.ts(2322)
QueryKeys.ts(11, 11): Did you mean to call this expression?
One of the other ones is this line
search: (query: string, limit: number) => [query, { limit }],
Type '(query: string, limit: number) => (string | { limit: number; })[]' is not assignable to type 'FactoryProperty'.
Type '(query: string, limit: number) => (string | { limit: number; })[]' is not assignable to type 'FactoryCallback'.
Type '(string | { limit: number; })[]' is not assignable to type 'AnyObject'.
Index signature for type 'string' is missing in type '(string | { limit: number; })[]'.
(property) search: (query: string, limit: number) => (string | {
limit: number;
})[]
Type '(query: string, limit: number) => (string | { limit: number; })[]' is not assignable to type 'FactoryProperty'.
Type '(query: string, limit: number) => (string | { limit: number; })[]' is not assignable to type 'FactoryCallback'.
Type '(string | { limit: number; })[]' is not assignable to type 'AnyObject'.
Index signature for type 'string' is missing in type '(string | { limit: number; })[]'.ts(2322)
I love the idea behind your library and would love to figure out why these are happening. I tried upgrading my typescript version to the latest and updating some of the properties in my tsconfig to match the projects but still receive these errors
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Documentation - TypeScript 3.9
As a result, TypeScript will see that the a property of A & B is incompatible with that of C : Type 'A...
Read more >Documentation - TypeScript 4.9
Let's take the following example in JavaScript: ... safe type like unknown for the packageJSON property would cause issues in older versions of...
Read more >JSDoc Reference - TypeScript: Documentation
The list below outlines which constructs are currently supported when using JSDoc annotations to provide type information in JavaScript files.
Read more >The starting point for learning TypeScript
TypeScript Documentation. Get Started. Quick introductions based on your background or preference. TS for the New Programmer · TypeScript for JS ...
Read more >Documentation - The Basics - TypeScript
Each and every value in JavaScript has a set of behaviors you can observe from running different operations. That sounds abstract, but as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That fixes the typescript errors, thank you!
Thanks @jrdn91, I’ll take a look and try to reproduce it and come back to you later today