ankurk91 / vue-web-storage

Vue.js plugin for local storage and session storage (1.8 kb min+gz) :floppy_disk:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not find a declaration file for module ... vue-web-storage.js' implicitly has an 'any' type

gillesgros opened this issue · comments

Hello,

When trying to run in a full app some 'vue-web-storage', I run into trouble.

Might be something missing ?

code (page.vue)

<template>
...
</template>

<script lang="ts">
import { Getter } from "vuex-class";
import { Vue, Component, Prop } from "vue-property-decorator";
import Storage from "vue-web-storage";  

Vue.use(Storage, {
  prefix: "MyCreator_",   // default `app_`
  drivers: ["session"]          //['session','local'], // default 'local' 
});
@Component
export default class PageComponent extends Vue {
  @Prop() readonly subtitle!: string;
  @Prop() readonly selectedType!: MenuItemType;
  @Getter("isCondensed") readonly isCondensed!: boolean;
  isCondensedMenuActive = false;
  menuItems = MENU_ITEMS;
  
  locales= [{id: 'en', name: 'English'}, {id: 'fr', name: 'Francais'}];
  handleMenuClick() {
    this.isCondensedMenuActive = !this.isCondensedMenuActive;
  }
  get selectedLanguage() {
    return Vue.$sessionStorage.get('selectedLanguage', 'en');
  }
  set selectedLanguage (value: string) {
    Vue.$sessionStorage.set('selectedLanguage');
  }
}
</script>

I get the following error

ERROR in H:\# Portable App\KingdomCreator-master\src\components\page.vue.ts
[tsl] ERROR in H:\# Portable App\KingdomCreator-master\src\components\page.vue.ts(58,21)
      TS7016: Could not find a declaration file for module 'vue-web-storage'. 'H:\# Portable App\KingdomCreator-master\node_modules\vue-web-storage\dist\vue-web-storage.js' implicitly has an 'any' type.

ERROR in H:\# Portable App\KingdomCreator-master\src\components\page.vue.ts
[tsl] ERROR in H:\# Portable App\KingdomCreator-master\src\components\page.vue.ts(109,16)
      TS2339: Property '$sessionStorage' does not exist on type 'VueConstructor<Vue>'.

ERROR in H:\# Portable App\KingdomCreator-master\src\components\page.vue.ts
[tsl] ERROR in H:\# Portable App\KingdomCreator-master\src\components\page.vue.ts(113,9)
      TS2339: Property '$sessionStorage' does not exist on type 'VueConstructor<Vue>'.

Please advice or help me fixing.

This package does not support type script