QwikDev / qwik

Instant-loading web apps, without effort
https://qwik.dev
MIT License
20.83k stars 1.31k forks source link

[🐞] useComputed no longer has a readonly type #6804

Open thejackshelton opened 3 months ago

thejackshelton commented 3 months ago

Which component is affected?

Qwik Runtime

Describe the bug

useComputed$ used to have a read-only type. As a result, TypeScript would properly tell the consumers in the IDE that they are modifying something that is read-only.

This has led to bugs from new contributors in Qwik UI

Reproduction

https://qwik.dev/playground/#f=Q0o0JqbG2BKNDkoKBvMgdTGYCS7lKE5XkEBKBJoLDCS4BRqGQDfCJJPQJY2QJJPhkoisBjEdZKYeMKsCC2FtsBkQjiYXUC%2B88kc4REEBWDuVgIqjYmCFCSzxQc7NAVenwDYKsITydHHVUUhKTU4EagaWpMBiFBiViSm6%2BXk5lXpARcUlQJ5CeSqoJAVWsArBwUEKwAI5v0gPZroriGel4JyYlwdME7ml4IonMxfEANYa0MoArBjkK6jbbRVMQb6tBbsbkQurEUpqR%2FPhUM6HAA

Steps to reproduce

1) Create a signal from a useComputed$ hook. 2) Modify that signal

System Info

N/A

Additional Information

No response

JerryWu1234 commented 2 months ago

I can try this one

JerryWu1234 commented 2 months ago

image In this case. TS has already hinted. @thejackshelton Could you tell me what you expect ?

wmertens commented 2 months ago

@JerryWu1234 strange, in the playground it doesn't error