sanity-io/block-content-to-react

Typescript support

Closed this issue · 10 comments

fandy commented

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

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

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

Thank you @balazsorban44. That worked perfectly.

This really should be added to the repo it self

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

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

amazing, thanks @rexxars, the new lib looks great

@rexxars any plans to support PortableText in React Native?

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

@rexxars any plans to support PortableText in React Native?

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

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.