🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

vue-typed-mixins

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-typed-mixins

Type safe Vue.js mixins

0.2.0
latest
Source
npm
Version published
Weekly downloads
7.5K
-4.81%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

Vue.js

FAQs

Package last updated on 11 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts