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

shallowReadonly assignment, no type error prompt #11474

Open
liuseen-l opened this issue Aug 1, 2024 · 0 comments · May be fixed by #11473
Open

shallowReadonly assignment, no type error prompt #11474

liuseen-l opened this issue Aug 1, 2024 · 0 comments · May be fixed by #11473

Comments

@liuseen-l
Copy link
Contributor

Vue version

v3.5.0-alpha.5

Link to minimal reproduction

https://play.vuejs.org/#eNp9UUtPAjEQ/itNLwvJWh/IhaCJGg6a+Ah6bGLqMguL3WnTdgFD9r87LbIaYrg07feY+aaz5TfWilUDfMTHvnCVDcxDaOy1xKq2xgW2ZQ5KltOpZgb1V+4XSmuznv68W1Y6U7OMimQSJRYGfWClMeyq8/QQ1uxR2V6/HyVECurSy1SWnydkb/tQjmwHHQ7cpOncF4SMT3fBKbJEnvPgqVZZzcXSG6S5thIZk7wwta00uGcbKuol+YglJnKp3UPCgmsg3+PFAorPf/Cl30RM8hcHHtwKJO+4oNwcwo6evD7Bhu4dWZtZo0l9hJyCN7qJGXey2wZnFPuPLqW9T9upcP7mJ5sA6PdDxaBR2Sa95LSXuyOj/8YdiMvkk9jSL76vwMWa9IEDMRRnJ0rbhRJD3n4DXDS6+Q==

Steps to reproduce

https://play.vuejs.org/#eNp9UUtPAjEQ/itNLwvJWh/IhaCJGg6a+Ah6bGLqMguL3WnTdgFD9r87LbIaYrg07feY+aaz5TfWilUDfMTHvnCVDcxDaOy1xKq2xgW2ZQ5KltOpZgb1V+4XSmuznv68W1Y6U7OMimQSJRYGfWClMeyq8/QQ1uxR2V6/HyVECurSy1SWnydkb/tQjmwHHQ7cpOncF4SMT3fBKbJEnvPgqVZZzcXSG6S5thIZk7wwta00uGcbKuol+YglJnKp3UPCgmsg3+PFAorPf/Cl30RM8hcHHtwKJO+4oNwcwo6evD7Bhu4dWZtZo0l9hJyCN7qJGXey2wZnFPuPLqW9T9upcP7mJ5sA6PdDxaBR2Sa95LSXuyOj/8YdiMvkk9jSL76vwMWa9IEDMRRnJ0rbhRJD3n4DXDS6+Q==

What is expected?

<script setup>
import { ref , readonly,shallowReadonly} from 'vue'

const foo = readonly(new Map())
//ts-error: Property 'set' does not exist on type 'ReadonlyMap<any, any>'.ts(2339)
foo.set('a',1) 


const bar = shallowReadonly(new Map())
//ts-error: Property 'set' does not exist on type 'ReadonlyMap<any, any>'.ts(2339)
bar.set('a',2)
</script>

What is actually happening?

<script setup>
import { ref , readonly,shallowReadonly} from 'vue'

const foo = readonly(new Map())
//ts-error: Property 'set' does not exist on type 'ReadonlyMap<any, any>'.ts(2339)
foo.set('a',1) 


const bar = shallowReadonly(new Map())
bar.set('a',2) // no error message
</script>

System Info

No response

Any additional comments?

No response

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 a pull request may close this issue.

1 participant