Skip to content

Commit

Permalink
feat: add basic typescript module declaration
Browse files Browse the repository at this point in the history
Thanks to @losfroger and @jim-toth in the related issue. This implementation
was a merge of their recommended fixes and the official Vue 3 Options API
Type Augmentation documentation.

I've tested the module definitions against a real-world Vue 3 codebase in both
Composition and Options API mode.

Closes #15.
  • Loading branch information
Kenneth-Sills committed Apr 9, 2024
1 parent f5bb39e commit 68d5233
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
13 changes: 13 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Shepherd from 'shepherd.js';
import { ObjectPlugin } from 'vue';

declare module 'vue-shepherd' {
export function useShepherd(...args: Array<Shepherd.Tour.TourOptions>): Shepherd.Tour;
export default ObjectPlugin;
}

declare module 'vue' {
interface ComponentCustomProperties {
$shepherd: (...args: Array<Shepherd.Tour.TourOptions>) => Shepherd.Tour;
}
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-shepherd",
"version": "3.0.0",
"version": "3.1.0",
"description": "A Vue wrapper for the site tour library Shepherd.",
"author": {
"name": "Robert Wagner",
Expand Down Expand Up @@ -29,10 +29,13 @@
"dist/vue-shepherd.esm.js.map",
"dist/vue-shepherd.min.js",
"dist/vue-shepherd.ssr.js",
"dist/index.d.ts",
"package.json",
"README.md",
"src"
"src",
"tsconfig.json"
],
"types": "./dist/index.d.ts",
"dependencies": {
"shepherd.js": "^11.2.0"
},
Expand Down

0 comments on commit 68d5233

Please sign in to comment.