
Security News
Potemkin Understanding in LLMs: New Study Reveals Flaws in AI Benchmarks
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
vue-typed-emit
Advanced tools
TypeScript utility type for Vue.js
$emit
❗ This library is intended to be used with Vue
<3
. Vue 3 provided a way to type emits.
$ npm i vue-typed-emit -D
$ yarn add vue-typed-emit --dev
import Vue from 'vue'
// import type { WithEvents } from 'vue-typed-emit' TypeScript 3.8+
import { WithEvents } from 'vue-typed-emit'
interface Events {
foo: string
bar: [string, number]
baz: undefined
}
export default (Vue as WithEvents<Events>).extend({
name: 'Component',
methods: {
method() {
this.$emit('foo', 'foo')
this.$emit('bar', 0)
this.$emit('baz')
},
},
})
// YourAwesomeExtendedComponent.vue
// ...
export default Vue.extend({
// ...
methods: {
baz() {},
},
// ...
})
// ...
import YourAwesomeExtendedComponent from 'path/to/your/awewsome/extended/component'
export default (
YourAwesomeExtendedComponent as WithEvents<
WithEvents,
typeof YourAwesomeExtendedComponent
>
).extend({})
import { SetupContext, defineComponent } from '@vue/composition-api'
// import type { CompositionAPIEmit } from 'vue-typed-emit' TypeScript 3.8+
import { CompositionAPIEmit } from 'vue-typed-emit'
interface Events {
foo: string
bar: [string, number]
baz: undefined
}
interface ExtendedSetupContext extends SetupContext {
emit: CompositionAPIEmit<Events>
}
export default defineComponent({
name: 'Component',
setup(props, { emit }: ExtendedSetupContext) {
emit('foo', 'foo')
emit('bar', 0)
emit('baz')
},
})
If your project is written using TypeScript + Vue.js, likely your components have some "contracts" – props they receive and events they emit. vue-typed-emit
is aimed to ensure that your components adhere to the contract they claimed when it comes to events emitting and corresponding payloads.
If event payload is type of of Array
it should be defined this way.
interface Events {
foo: [string[]]
}
npm run test
npm run build
FAQs
TypeScript utility type for Vue.js $emit
The npm package vue-typed-emit receives a total of 641 weekly downloads. As such, vue-typed-emit popularity was classified as not popular.
We found that vue-typed-emit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.