vue-typed-mixins

Type safe Vue.js mixins
360,756 104
Install
npm install vue-typed-mixins
Latest Version:0.2.0
Vue:2
License:MIT
Last Updated:Nov 11, 2019
Links: GitHub  ·  npm
Maintainer: ktsn

Vue Typed Mixins

Type safe Vue.js mixins.

Example

This has the same capability of canonical Vue mixins, but is type safe in TypeScript.

import Vue from 'vue'
import mixins from 'vue-typed-mixins'

const Foo = Vue.extend({
  data() {
    return {
      foo: 'test'
    }
  }
})

const Bar = Vue.extend({
  data() {
    return {
      bar: 123
    }
  }
})

const App = mixins(Foo, Bar).extend({
  data() {
    return {
      value: true
    }
  },

  computed: {
    concat(): string {
      return `${this.foo} ${this.bar} ${this.value}`
    }
  }
})

const vm = new App()
assert(vm.foo === 'test')
assert(vm.bar === 123)
assert(vm.value === true)
assert(vm.concat === 'test 123 true')

License

MIT

Related Packages

vuex-smart-module

Type safe Vuex module with powerful module features

78,801 372
@vesperjs/vue

This is Vesper for Vue.js.

8,552 1
@wzpo/md-ui

Another Momentum UI framework for Vue.js applications

2,054
vuenilla

Unstyled Vue.js component library.

1,552 2
vue-awesome

Font Awesome component for Vue.js, using inline SVG.

510,216 2,422

Version History

Version Released License
0.2.0 MIT
0.1.0 MIT