feat(@types/vue-clickaway): create types (#38962)

* feat(@types/vue-clickaway): create types

* fix: rename to vue-clickaway-tests.ts
This commit is contained in:
Khoa Nguyen
2019-10-09 17:05:41 -07:00
committed by Armando Aguirre
parent 7d1ee0c34a
commit c79ad1cd46
5 changed files with 69 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for vue-clickaway 2.2
// Project: https://github.com/simplesmiler/vue-clickaway
// Definitions by: Khoa Nguyen <https://github.com/khoanguyen96>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.6
import Vue, { ComponentOptions, DirectiveOptions } from 'vue';
export const directive: DirectiveOptions;
export const mixin: ComponentOptions<Vue> | typeof Vue;
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"vue": "^2.0.0"
}
}
+29
View File
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": [
"DOM",
"ES6",
"DOM.Iterable",
"ScriptHost"
],
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"esModuleInterop": true,
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"experimentalDecorators": true
},
"files": [
"index.d.ts",
"vue-clickaway-tests.ts"
]
}
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "dtslint/dt.json"
}
@@ -0,0 +1,21 @@
import Vue, { ComponentOptions } from 'vue';
import { directive, mixin } from 'vue-clickaway';
// excerpt from vue-class-component/src/declarations.ts
type VueClass<V> = { new (...args: any[]): V & Vue } & typeof Vue;
// excerpt from vue-class-component/src/index.ts
function Component(options: ComponentOptions<Vue> | VueClass<Vue>): any {
return null; // mocked
}
@Component({
directives: {
clickaway: directive,
},
})
export class ComponentWithDirective extends Vue {}
@Component({
mixins: [mixin],
})
export class ComponentWithMixin extends Vue {}