Skip to content
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

Typescript support? #107

Open
alvinfebriando opened this issue May 8, 2020 · 4 comments · May be fixed by #117
Open

Typescript support? #107

alvinfebriando opened this issue May 8, 2020 · 4 comments · May be fixed by #117

Comments

@alvinfebriando
Copy link

How to use this library with typescript? It's said no typings were found

@mokkabonna
Copy link
Owner

mokkabonna commented Aug 31, 2020

I think it is possible to use this library with typescript without any modifications.

But I guess the type hinting for the options could be supplied. I am not familiar with typescript, so any suggestion/explanation of how this could work is welcome.

@moshfeu moshfeu linked a pull request Oct 10, 2020 that will close this issue
@c-vetter
Copy link

c-vetter commented Feb 5, 2022

For those who need a quick fix until the actual types land, here's what I'm doing:

  • Create _inquirer-autocomplete-prompt.d.ts somewhere reachable from your code, e.g. in src, with this content:
    declare module 'inquirer-autocomplete-prompt'
  • Add this line at the beginning of every file where you import autocomplete from 'inquirer-autocomplete-prompt':
    /// <reference path='_inquirer-autocomplete-prompt.d.ts'/>
  • Take care of the remaining types locally

I have no errors and the whole thing works.

@c-vetter
Copy link

c-vetter commented Feb 5, 2022

I will review the PR to help this along.
Fixing it is out of scope for now, though, due to other work.

@jayeeson
Copy link

jayeeson commented Jan 8, 2023

Type definitions are in DefinitelyTyped/inquirer-autocomplete-prompt (project page)

Just need to import @types/inquirer-autocomplete-prompt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants