diff --git a/types/vue-clickaway/index.d.ts b/types/vue-clickaway/index.d.ts new file mode 100755 index 0000000000..3282647830 --- /dev/null +++ b/types/vue-clickaway/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for vue-clickaway 2.2 +// Project: https://github.com/simplesmiler/vue-clickaway +// Definitions by: Khoa Nguyen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.6 +import Vue, { ComponentOptions, DirectiveOptions } from 'vue'; + +export const directive: DirectiveOptions; +export const mixin: ComponentOptions | typeof Vue; diff --git a/types/vue-clickaway/package.json b/types/vue-clickaway/package.json new file mode 100755 index 0000000000..6d2cf27adf --- /dev/null +++ b/types/vue-clickaway/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "vue": "^2.0.0" + } +} diff --git a/types/vue-clickaway/tsconfig.json b/types/vue-clickaway/tsconfig.json new file mode 100755 index 0000000000..676486c297 --- /dev/null +++ b/types/vue-clickaway/tsconfig.json @@ -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" + ] +} diff --git a/types/vue-clickaway/tslint.json b/types/vue-clickaway/tslint.json new file mode 100755 index 0000000000..7fceda52e9 --- /dev/null +++ b/types/vue-clickaway/tslint.json @@ -0,0 +1,4 @@ +{ + "extends": "dtslint/dt.json" +} + diff --git a/types/vue-clickaway/vue-clickaway-tests.ts b/types/vue-clickaway/vue-clickaway-tests.ts new file mode 100644 index 0000000000..2aa5781098 --- /dev/null +++ b/types/vue-clickaway/vue-clickaway-tests.ts @@ -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 = { new (...args: any[]): V & Vue } & typeof Vue; +// excerpt from vue-class-component/src/index.ts +function Component(options: ComponentOptions | VueClass): any { + return null; // mocked +} + +@Component({ + directives: { + clickaway: directive, + }, +}) +export class ComponentWithDirective extends Vue {} + +@Component({ + mixins: [mixin], +}) +export class ComponentWithMixin extends Vue {}