it('mapStores computes only once when mapping multiple stores', async () => {
const pinia = createPinia()
const fromStore = jest.fn(function () {
- // @ts-ignore
+ // @ts-expect-error
return this.mainStore
})
const Component = defineComponent({
...computedProperties,
},
methods: Object.keys(computedProperties).reduce((methods, name) => {
- // @ts-ignore
+ // @ts-expect-error
methods['set_' + name] = function (v: any) {
- // @ts-ignore
+ // @ts-expect-error
this[name] = v
}
return methods
expect(wrapper.text()).toBe(expectedText)
for (const key in computedProperties) {
- // @ts-ignore
+ // @ts-expect-error
wrapper.vm['set_' + key]('replaced')
}
const context = createContext()
const app = await renderApp(context)
- // @ts-ignore
const html = await renderer.renderToString(app, context)
expect(html).toMatchInlineSnapshot(
`"<div data-server-rendered=\\"true\\"><h2>Hi anon</h2> <p>Count: 1 x 2 = 2</p> <button>Increment</button></div>"`
let context = createContext()
let app = await renderApp(context)
- // @ts-ignore
let html = await renderer.renderToString(app, context)
expect(html).toMatchInlineSnapshot(
`"<div data-server-rendered=\\"true\\"><h2>Hi anon</h2> <p>Count: 1 x 2 = 2</p> <button>Increment</button></div>"`
context = createContext()
app = await renderApp(context)
- // @ts-ignore
html = await renderer.renderToString(app, context)
expect(html).toMatchInlineSnapshot(
`"<div data-server-rendered=\\"true\\"><h2>Hi anon</h2> <p>Count: 1 x 2 = 2</p> <button>Increment</button></div>"`
import { createApp } from './main'
export default function (context: any) {
- return new Promise((resolve) => {
+ return new Promise<ReturnType<typeof createApp>['app']>((resolve) => {
const { app, pinia } = createApp()
// This `rendered` hook is called when the app has finished rendering
const pinia = createPinia()
Vue.use(PiniaPlugin)
const app = new Vue({
- // @ts-ignore
pinia,
render: (h) => h(App),
})
// @ts-check
/// <reference types="./types" />
import Vue from 'vue'
-// @ts-ignore: this must be pinia to load the local module
+// @ts-expect-error: this must be pinia to load the local module
import { setActivePinia, PiniaPlugin, createPinia } from 'pinia'
Vue.use(PiniaPlugin)
setActivePinia(pinia)
// we bypass warnings
- // @ts-ignore
+ // @ts-expect-error
pinia._p.push(() => ({ $nuxt: context }))
if (process.server) {
PiniaPlugin()
createPinia()
-// @ts-ignore
+// @ts-expect-error
export default defineStore()
}
return stores.reduce((reduced, useStore) => {
- // @ts-ignore: $id is added by defineStore
+ // @ts-expect-error: $id is added by defineStore
reduced[useStore.$id + mapStoreSuffix] = function (this: Vue) {
return getCachedStore(this, useStore)
}
): _MapWritableStateReturn<S> | _MapWritableStateObjectReturn<S, KeyMapper> {
return Array.isArray(keysOrMapper)
? keysOrMapper.reduce((reduced, key) => {
- // @ts-ignore
reduced[key] = {
get(this: ComponentPublicInstance) {
return getCachedStore(this, useStore)[key]
return reduced
}, {} as _MapWritableStateReturn<S>)
: Object.keys(keysOrMapper).reduce((reduced, key: keyof KeyMapper) => {
- // @ts-ignore
reduced[key] = {
get(this: ComponentPublicInstance) {
return getCachedStore(this, useStore)[keysOrMapper[key]]
if (isPlainObject(targetValue) && isPlainObject(subPatch)) {
target[key] = innerPatch(targetValue, subPatch)
} else {
- // @ts-ignore
+ // @ts-expect-error
target[key] = subPatch
}
}
}
const state = rootStateRef.value[id]
for (const key in state) {
- // @ts-ignore: the key matches
+ // @ts-expect-error: the key matches
reactiveObject[key] = computed({
get: () => rootStateRef.value[id][key as keyof T],
set: (value) => (rootStateRef.value[id][key as keyof T] = value),