-
Notifications
You must be signed in to change notification settings - Fork 859
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sdk): Allow passing readonly arrays (#3308)
## 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>
- Loading branch information
1 parent
f3aab34
commit 46c38b8
Showing
2 changed files
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@builder.io/sdk": patch | ||
--- | ||
|
||
Fix: Mark component types as `readonly`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters