quasar icon indicating copy to clipboard operation
quasar copied to clipboard

Typescript error in boot files using store

Open MichaelJCole opened this issue 3 years ago • 9 comments

Describe the bug

Property 'store' does not exist on type 'BootFileParams <any>'.ts(2339)

or if I pass a type to the template

Property 'store' does not exist on type 'BootFileParams <StateInterface>'.ts(2339)

Codepen/jsFiddle/Codesandbox (required or your issue may be closed)

To Reproduce quasar new boot newfile --format ts

then uncomment parameters and add 'store'

Here is as close as I could get it:

const callback: BootCallback<StateInterface> = async ({ app, store }) => {
  await store.dispatch('auth/checkSession').catch(console.error)
}
export default boot(callback)

Here's a version I got to work without boot()

export default ({ app, store }: { app: App; store: Store<StateInterface> }) => {
  store.dispatch('auth/checkSession').catch(console.error)
}

MichaelJCole avatar Jan 05 '22 23:01 MichaelJCole

same with https://github.com/quasarframework/quasar/issues/8794

metalsadman avatar Jan 06 '22 02:01 metalsadman

@metalsadman Thanks for the reference. Unfortunately, I verified the file and am still having the problem.

This time trying to make a navigation guard that uses store in /router/index.ts

My file looks like this file I found on github to verify against.

I also can't get the feature flag for ssr to work. 'quasar mode add ssr' creates the src-ssr directory with it's flag file, but neither the quasar typescript compiler, or vscode add the type.

So look, this same problem also appears here, in both VScode and quasar's compiler. Any other suggestions?

export default route(function ({ store })) { ... }

(parameter) store: any
'store' is declared but its value is never read.ts(6133)
Property 'store' does not exist on type '{}'.ts(2339)

MichaelJCole avatar Jan 10 '22 14:01 MichaelJCole

@MichaelJCole did you ever figure out a solution?

My project has been working fine for months, but after a reboot I'm getting the same error even though store-flag.d.ts exists.

mlilback avatar Apr 20 '22 13:04 mlilback

Hey, I think I'm still using the workaround.

On Wed, Apr 20, 2022, 8:20 AM Mark Lilback @.***> wrote:

@MichaelJCole https://github.com/MichaelJCole did you ever figure out a solution?

My project has been working fine for months, but after a reboot I'm getting the same error even though store-flag.d.ts exists.

— Reply to this email directly, view it on GitHub https://github.com/quasarframework/quasar/issues/11921#issuecomment-1103924381, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALPMFRTT27BUIVYEXZGYILVGAAB5ANCNFSM5LLDIZ7Q . You are receiving this because you were mentioned.Message ID: @.***>

MichaelJCole avatar Apr 20 '22 17:04 MichaelJCole

Still running into this in 2024. Is there any fix?

domlysi avatar Apr 15 '24 16:04 domlysi

The issue is still open... 4:69 error Unsafe argument of type anyassigned to a parameter of typePinia @typescript-eslint/no-unsafe-argument

MartinX3 avatar Aug 11 '24 16:08 MartinX3

Let's take a look at https://github.com/quasarframework/quasar/pull/17429 / @quasar/app-vite-v2.0.0-beta.19 Maybe it's fixed again.

MartinX3 avatar Aug 15 '24 10:08 MartinX3

Still an issue.

MartinX3 avatar Oct 09 '24 13:10 MartinX3

@MartinX3 can you provide a reproduction, please?

yusufkandemir avatar Oct 18 '24 11:10 yusufkandemir

Have the same issue when upgrading from @quasar/app-vite 2.0.0-beta.15 to 2.0.0-beta.24

This is still an issue with SPA apps.

Had to delete node_modules and .quasar directories. You might want to add a note about this.

opsec-infosec avatar Oct 21 '24 13:10 opsec-infosec

I have the same problem with a new project.

jjjjose avatar Dec 18 '24 02:12 jjjjose

@jjjjose which command did you use to create the project, and which options did you choose during project creation? How can we reproduce the problem?

yusufkandemir avatar Dec 18 '24 07:12 yusufkandemir

There was #17743 for app-webpack, it got fixed. So, this issue should not happen in new projects for app-vite/app-webpack.

To anyone still having a similar problem, we've dropped vuex support, that might be the reason. So, migrate your project accordingly or use it as a regular Vue plugin in a boot file. Thanks.

yusufkandemir avatar Jan 14 '25 18:01 yusufkandemir