Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust ReadOnlySignal so we cant widen the type #587

Merged
merged 3 commits into from
Aug 3, 2024

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Aug 2, 2024

Avoid inheriting from signal in ReadonlySignal so we can't accidentally widen the type by doing const computed: Signal<any> = useComputed(() => {}), in widening this type we would lose the readonly aspect of the value property effectively making it a mutable signal.

Fixes #585

Copy link

changeset-bot bot commented Aug 2, 2024

🦋 Changeset detected

Latest commit: 57ab3de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@preact/signals-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Aug 2, 2024

Deploy Preview for preact-signals-demo ready!

Name Link
🔨 Latest commit 57ab3de
🔍 Latest deploy log https://app.netlify.com/sites/preact-signals-demo/deploys/66addf2f1a208e0008924c3d
😎 Deploy Preview https://deploy-preview-587--preact-signals-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Aug 2, 2024

Size Change: 0 B

Total Size: 83 kB

ℹ️ View Unchanged
Filename Size
docs/dist/assets/bench.********.js 1.59 kB
docs/dist/assets/client.********.js 46.3 kB
docs/dist/assets/index.********.js 838 B
docs/dist/assets/jsxRuntime.module.********.js 284 B
docs/dist/assets/preact.module.********.js 4.03 kB
docs/dist/assets/signals-core.module.********.js 1.4 kB
docs/dist/assets/signals.module.********.js 2.02 kB
docs/dist/assets/style.********.js 21 B
docs/dist/assets/style.********.css 1.24 kB
docs/dist/basic-********.js 244 B
docs/dist/demos-********.js 3.45 kB
docs/dist/nesting-********.js 1.13 kB
docs/dist/react-********.js 242 B
packages/core/dist/signals-core.js 1.45 kB
packages/core/dist/signals-core.mjs 1.47 kB
packages/preact/dist/signals.js 1.27 kB
packages/preact/dist/signals.mjs 1.22 kB
packages/react-transform/dist/signals-*********.js 5.03 kB
packages/react-transform/dist/signals-transform.mjs 4.27 kB
packages/react-transform/dist/signals-transform.umd.js 5.15 kB
packages/react/dist/signals.js 188 B
packages/react/dist/signals.mjs 150 B

compressed-size-action

@JoviDeCroock JoviDeCroock force-pushed the avoid-readonly-inheritance branch from 8be3c70 to 703dcb4 Compare August 2, 2024 17:09
@@ -0,0 +1,6 @@
---
"@preact/signals-core": minor
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might need to be a major though 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor for a type correction is completely a-ok, IMO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll expand on the changeset then to provide our reasoning to avoid excessive issues about it

@JoviDeCroock JoviDeCroock force-pushed the avoid-readonly-inheritance branch from 2a9febb to 57ab3de Compare August 3, 2024 07:41
@JoviDeCroock JoviDeCroock merged commit cd9efbb into main Aug 3, 2024
6 checks passed
@JoviDeCroock JoviDeCroock deleted the avoid-readonly-inheritance branch August 3, 2024 12:19
@github-actions github-actions bot mentioned this pull request Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReadonlySignal should not inherit from Signal type
3 participants