alexurquhart/vue-bootstrap-typeahead

How it will work with typescript?

Closed this issue · 2 comments

Not working with typescript, I'm getting error Error: Cannot find module 'vue-bootstrap-typeahead'. It's asking for dev dependency '@types/vue-bootstrap-typeahead'.

A workaround that you can do is put in a file like a typings.d.ts

declare module "vue-bootstrap-typeahead";

This is my simple type definitions file.

declare module 'vue-bootstrap-typeahead' {

    import {Component} from "vue";

    interface Props {
        data: any[];
        serializer?: (input: string) => string;
        size?: 'sm' | 'lg';
        backgroundVariant?: string;
        textVariant?: string;
        inputClass?: string;
        maxMatches?: number;
        minMatchingChars?: number;
        prepend?: string;
        append?: string;
    }

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

    export default VueBootstrapTypeahead;
}