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 and SerializableParam type

See original GitHub issue

I had a problem with SerializableParam type the scenario is when I have type contend a function the fix is sample

export type SerializableParam = Primitive | ReadonlyArray<SerializableParam> | Readonly<{[key: string]: SerializableParam}> | Readonly<(prams: SerializableParam) => SerializableParam | void >;

and thanks for great job

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Newbie012commented, Jul 7, 2021

I guess you’re right about this specific case. But what if the API class would’ve been constructed like so:

class API {
    constructor(private apiToken: string) {}

    async getSomething() {
        return fetchStuff("URL", { auth: this.apiToken });
    }
}
const api = new API("THIS_IS_THE_API_TOKEN");

function App({ api }) {
    const data = useRecoilValue(selector, { api });
}

Note that App has no access to the API token, but only the instance of the API. The only alternative would be to pass the API token to the selectorFamily and instantiate a new API class, but it feels cumbersome.

0reactions
drarmstrcommented, Aug 18, 2022

A lookup map can also be used for the tokens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript recoil cheat sheet
This is a list of TypeScript types for recoil generated from the declaration files in ... AtomFamilyOptions<T, P extends SerializableParam> (interface) ...
Read more >
recoil SerializableParam TypeScript Examples
This page shows TypeScript code examples of recoil SerializableParam.
Read more >
selectorFamily(options)
Returns a function that returns a read-only RecoilValueReadOnly or writeable RecoilState selector. A selectorFamily is a powerful pattern that is similar to a ......
Read more >
Problem with Types in typescript: Argument of type is not ...
I have figured it out: I had to do "type assertion". Type "NewEntry" does not have an id property, but I am adding...
Read more >
recoil-sync-next - NPM Package Overview
... 8835d49: Update typescript-eslint monorepo to v5.32.0 (renovate[bot]) #66; d4cb5b3: Update dependency @types/react to v18.0.17 ...
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