question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript issues following example docs

See original GitHub issue

I’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:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jrdn91commented, Aug 30, 2022

That fixes the typescript errors, thank you!

1reaction
lukemoralescommented, Aug 30, 2022

Thanks @jrdn91, I’ll take a look and try to reproduce it and come back to you later today

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found