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.

recoil-sync and types

See original GitHub issue

Hi,

When using recoil-sync with typescript I get

Could not find a declaration file for module 'recoil-sync'.

Is there a config setting I’m missing?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
brncskcommented, May 14, 2022

@mondaychen Thanks for the release!

As for the typing issue, I created my own .d.ts file:

declare module "refine" {
  // Insert the contents of https://github.com/facebookexperimental/Recoil/blob/main/typescript/refine.d.ts here
}

declare module "recoil-sync" {
  // Insert the contents of https://github.com/facebookexperimental/Recoil/blob/main/typescript/recoil-sync.d.ts here

  export const refine: typeof import("refine");
}

And now I can use the URL sync functionality without relying on my own builds, yay! 😃

2reactions
mondaychencommented, May 13, 2022

Well, to correctly set up types (without publishing refine as its own package) is more complicated than I expected. I’ve published 0.0.1-alpha.2 for recoil-sync anyways since not many people are using it. You can do import {refine} from 'recoil-sync' now. It should work (e.g. refine.assertion will throw if types don’t match), but I expect typing (for both typescript and flow) to be missing or buggy for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Recoil Sync Library
The recoil-sync NPM package provides an add-on library to help synchronize Recoil state with external systems. Simple asynchronous data queries can be ...
Read more >
recoil-sync - npm
recoil -sync provides an add-on library to help synchronize Recoil state with external systems. Latest version: 0.2.0, last published: 2 ...
Read more >
recoil-sync - NPM Package Overview - Socket.dev
recoil -sync provides an add-on library to help synchronize Recoil state with external systems. Version: 0.2.0 was published by drarmstr.
Read more >
Recoil (@recoiljs) / Twitter
The recoil-sync NPM package provides an add-on library to help synchronize Recoil state with external systems. Simple asynchronous data queries can be ...
Read more >
Recoil: the Future of State Management for React? - Syncfusion
Recoil has two key concepts: Atoms; Selectors. Syncfusion React UI components are the developers' ...
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