sanity-io / block-content-to-react

Deprecated in favor of @portabletext/react
https://github.com/portabletext/react-portabletext
MIT License
161 stars 25 forks source link

Typescript support #26

Closed andyfangaf closed 2 years ago

andyfangaf commented 4 years ago

Would be great to get Enums for block types, like in Contentful. Also, typings for the props of the render nodes would be useful.

balazsorban44 commented 4 years ago

To anyone interested, I created this repo very fast. It is not complete, but a starting point. I plan to expand it as I go along:

https://github.com/nhi/sanity-block-content-to-react-types

Feel free to open a PR with improvements! When it is a bit more complete, I can try moving it to DefinitelyTyped

nclarx commented 4 years ago

Thanks @balazsorban44 this is just what I was looking for, I'll see about opening a PR if I can contribute anything useful!

GHesericsu commented 3 years ago

Thank you @balazsorban44. That worked perfectly.

simonpeters commented 2 years ago

This really should be added to the repo it self

rexxars commented 2 years ago

Check out the new @portabletext/react module with full typescript support!

https://github.com/portabletext/react-portabletext

nclarx commented 2 years ago

amazing, thanks @rexxars, the new lib looks great

pixelknitter commented 2 years ago

@rexxars any plans to support PortableText in React Native?

ShayNehmad-RecoLabs commented 1 year ago

Any chance of getting react16 support on @portabletext/react?

rexxars commented 1 year ago

@rexxars any plans to support PortableText in React Native?

There is an experimental renderer for it, yes: https://github.com/portabletext/react-native-portabletext

rexxars commented 1 year ago

Any chance of getting react16 support on @portabletext/react?

No, probably not. The library is built with hooks. This library should still work though, even if typings aren't available.