-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would be nice to add type declarations for typescript #15
Comments
Hi @garyo, I totally agree! We have the types in the main Shepherd repo here https://github.com/shipshapecode/shepherd/tree/master/src/types Can those be imported and used? |
I would think so, though you'll still need to add types for the things you add to the Vue prototype. |
@garyo I don't think we added anything to this Vue wrapper really. I had plans to add more features, but I've been busy with other things. If you'd like to add imports of the types here and/or other features, we would love the help! |
I'm realizing the same thing -- I think it's trivial to just use |
You could also add this to your declaration file to make use of the injected function as intended, with types from import Shepherd from 'shepherd.js'
declare module 'vue-shepherd'
declare module 'vue/types/vue' {
// this.$myInjectedFunction inside Vue components
interface Vue {
$shepherd: (...args: any[]) => Shepherd.Tour
}
} |
@jim-toth perhaps we should use that as the types for this repo? I would definitely accept a PR adding a types file. |
if i use |
@manuel-84 sorry to hear that. As mentioned above, I would accept a PR to fix TS. The types exist in Shepherd itself. |
For the composition api the following declaration file works really well: import Shepherd from 'shepherd.js'
declare module 'vue-shepherd' {
export function useShepherd(...args: Array<Shepherd.Tour.TourOptions>): Shepherd.Tour
} |
If anyone would like to open a PR adding types, I would gladly accept it! |
I got it working by adding a
.d.ts
containing justdeclare module vue-shepherd
but it would be good to include a more complete type declaration for typescript users.The text was updated successfully, but these errors were encountered: