inquirer-autocomplete-prompt
inquirer-autocomplete-prompt copied to clipboard
Typescript support?
How to use this library with typescript? It's said no typings were found
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.
For those who need a quick fix until the actual types land, here's what I'm doing:
- Create
_inquirer-autocomplete-prompt.d.tssomewhere reachable from your code, e.g. insrc, 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.
I will review the PR to help this along. Fixing it is out of scope for now, though, due to other work.
Type definitions are in DefinitelyTyped/inquirer-autocomplete-prompt (project page)
Just need to import @types/inquirer-autocomplete-prompt