mattzollinhofer/vue-typeahead-bootstrap

Typescript support

Opened this issue · 7 comments

wolph commented

I've made a basic definition which should do the trick :)

// vue-typeahead-bootstrap.d.ts
declare module 'vue-typeahead-bootstrap' {

    import {Component} from 'vue';

    interface Props {
        append?: string;
        autoClose?: boolean;
        backgroundVariant?: string;
        data: any[];
        disabled?: boolean;
        disabledValues?: any[];
        disableSort?: boolean;
        highlightClass?: string;
        inputClass?: string;
        maxMatches?: number;
        minMatchingChars?: number;
        prepend?: string;
        serializer?: (input: string) => string;
        showAllResults?: boolean;
        showOnFocus?: boolean;
        size?: 'sm' | 'lg';
        textVariant?: string;
    }

    const VueTypeaheadBootstrap: Component<any, any, any, Props>;

    export default VueTypeaheadBootstrap;
}

I'm not super familiar (not familiar at all...). I just don't have a preference here or really know the cost vs the value of this. The only thing that strikes me as an issue is ensuring we keep this definition up to date, feels like I'm completely forget to update this.

@BozoJim @alpharahl any thoughts?

wolph commented

Well... honestly, keeping it up to date isn't even that much of a problem really. It might depend on the editor but at least Jetbrains Webstorm doesn't complain if you add different arguments than the supported ones.

And I have to say, I'm no expert either so perhaps it can be improved. But this at least removes the warnings from my editor :)

Yeah I had to add this manually for my project, it would be great if it was included

Alright, I let this sit long enough, sorry about that.

If someone (@wolph, @eberkund ?) submits a PR for this I'll merge it.

wolph commented

@mattzollinhofer I've created a pull request, but I'm honestly not sure if I'm doing it correctly. I've never published an npm package :)

hmm, well I don't really know how to test PR (#68) so I hesitate to just accept it. Can anyone help give us some more confidence in this?

wolph commented

@eberkund perhaps you can test this?

I can't really test my own pull request without bias :)