Types are not preserved
See original GitHub issueReproduction
https://stackblitz.com/edit/github-zrvb8t?file=src/App.vue
Steps to reproduce the bug
Open the reproduction and see the browser view.
Expected behavior
Since product
type in useStore
is Ref<Product>
, I expect it to be:
Product
when doingconst { product } = useStore()
Ref<Product>
when doingconst { product } = storeToRefs(useStore())
Actual behavior
product
type is object
.
Additional information
The current workaround I found:
const store = useStore();
const { product }: { product: Ref<product>; } = storeToRefs(store) as any;
const {} = store; // actions
I think it doesn’t change anything but I’m not using TypeScript in strict mode.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Type-Preserving CPS Translation of Σ and Π Types is Not Not ...
In this paper, we prove that type-preserving CPS translation for dependently typed languages is not not possible. We develop both call-by-name and call-by-value ......
Read more >Which MongoDB types are not preserved by ... - Stack Overflow
To preserve type information, mongoexport and mongoimport uses the strict mode representation for certain types. What exactly are the types that ...
Read more >How to solve the error: Preservation Types not valid
Edit the "Preservation Type" table and add your new preservation type ; Save. The preservation type should match exactly the names in the...
Read more >Which MongoDB types are not preserved by ... - Google Groups
My collection doesn't use any exotic types (only double, int, date, string, bool, object and array), so I should not experience any corruption....
Read more >Type Systems - Software Foundations
The preservation theorem is often called subject reduction, because it tells us what happens when the "subject" of the typing relation is reduced....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
that’s probably a config issue, some options might be overriding some of the rules set by strict true. You should be able to find some help in the discord chat 👍
My current workaround
const { product }: ToRefs<Pick<IStoreReturn, 'product'>> = storeToRefs(store);