Typescript support for custom component inputs

When you provide input fields for custom component you need to match them to actual component props. That means there is plenty of room to make a mistake, make a typo with the “name” or provide wrong type.
Wouldn’t that amazing to be able to pass some Type generic while registering component to make declaring inputs type safety and to get the autocompletion?
To move it even further, maybe there could be some tool which transforms Type into builder inputs.

What do you think? Maybe I’m missing something?

Hi @Mimoid,

A Builder user has put together an open-source library that allows you to maintain your component props in sync with the Builder input fields: GitHub - davedbase/builderio-type-extensions: A package that makes inferring Builder types easy.

You can create an array of input fields, and the library will take care of generating Typescript generics that you can feed to your component’s prop types!

  • Sami
1 Like