Skip to content

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

Merged
dai-shi merged 2 commits into
mainfrom
fix/docs/readme
Feb 12, 2022
Merged

fix(docs): add note in readme about loose typing of useSnapshot#357
dai-shi merged 2 commits into
mainfrom
fix/docs/readme

Conversation

@dai-shi

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

Copy link
Copy Markdown
Member

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

vercel Bot commented Feb 11, 2022

Copy link
Copy Markdown

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

codesandbox-ci Bot commented Feb 11, 2022

Copy link
Copy Markdown

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

dai-shi commented Feb 11, 2022

Copy link
Copy Markdown
Member Author

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

@github-actions

github-actions Bot commented Feb 11, 2022

Copy link
Copy Markdown

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