Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docs): add note in readme about loose typing of useSnapshot #357

Merged
merged 2 commits into from
Feb 12, 2022

Conversation

dai-shi
Copy link
Member

@dai-shi dai-shi commented Feb 11, 2022

close #327


With #359, we can do Module Augmentation.

https://codesandbox.io/s/react-typescript-forked-qphpi?file=/src/App.tsx:46-125

declare module "valtio" {
  function useSnapshot<T extends object>(p: T): T;
}

@vercel
Copy link

vercel bot commented Feb 11, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pmndrs/valtio/8ZaFDxQ6EdiNs6vXg3PxcKDStSCi
✅ Preview: https://valtio-git-fix-docsreadme-pmndrs.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 11, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d1d0113:

Sandbox Source
React Configuration
React Typescript Configuration
React Browserify Configuration
React Snowpack Configuration
React Parcel Configuration
React Typescript (forked) PR

@dai-shi
Copy link
Member Author

dai-shi commented Feb 11, 2022

Hmm, I wonder if Module Augmentation works in this case.

@github-actions
Copy link

github-actions bot commented Feb 11, 2022

Size Change: 0 B

Total Size: 34.5 kB

ℹ️ View Unchanged
Filename Size
dist/esm/index.js 1.36 kB
dist/esm/macro.js 613 B
dist/esm/utils.js 3.91 kB
dist/esm/vanilla.js 1.84 kB
dist/index.js 1.45 kB
dist/macro.js 910 B
dist/system/index.js 1.59 kB
dist/system/macro.js 721 B
dist/system/utils.js 4.14 kB
dist/system/vanilla.js 1.98 kB
dist/umd/index.js 1.59 kB
dist/umd/macro.js 1.06 kB
dist/umd/utils.js 4.71 kB
dist/umd/vanilla.js 2.1 kB
dist/utils.js 4.54 kB
dist/vanilla.js 1.96 kB

compressed-size-action

@dai-shi dai-shi merged commit ce5bce6 into main Feb 12, 2022
@dai-shi dai-shi deleted the fix/docs/readme branch February 12, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

readonly considered as a breaking change?
1 participant