You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
We are trying to create type interfaces for Props to our React components, which requires as const, however the inputs cannot be readonly
## Description
It should be possible to assign readonly types to `Component` and other
`@builder.io/sdk` types, since no mutations are(/should) happening.
This is needed to make type inference working in the
[`@oak-digital/builder-helpers`](https://github.com/Oak-Digital/builder-helpers)
package.
See the following example:
```ts
import Counter from './counter';
const registerCounter = {
name: 'Counter',
inputs: [
{
name: 'text',
type: 'string',
},
];
} as const;
Builder.registerComponent(Counter, registerCounter);
```
This example would result in a type error while registering the
component to builder. This is not really desired, so this PR makes it
possible to ALSO assign readonly types.
This PR fixes#3293
---------
Co-authored-by: Sami Jaber <me@sami.website>
Describe the bug
We are trying to create type interfaces for Props to our React components, which requires
as const
, however theinputs
cannot bereadonly
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Being able to assign
readonly
Additional context
We would like this to be
readonly
builder/packages/sdks/src/types/components.ts
Line 19 in 5c7cd8c
The text was updated successfully, but these errors were encountered: