I encountered an issue while trying to reference a state variable through the store mechanism
import { AppState } from '@/types'
import { localStorage } from '@/utils/storage';
import { defineStore } from 'pinia';
import { getLanguage } from '@/lang/index';
const useAppStore = defineStore({
id: 'appStore',
state: (): AppState => ({
device: 'desktop',
language: getLanguage(),
}),
action: {
setLanguage(language:string) {
this.language = language;
localStorage.set('language', language);
},
},
});
export default useAppStore;
Please refer to the attached image for more details.
It seems like there might be an issue related to TypeScript or possibly some settings. Can you help identify the root cause of this problem?