Closed roybass closed 5 years ago
I'm just using this:
declare module "inquirer-autocomplete-prompt" {
import { PromptModule } from "inquirer";
let AutocompletePrompt: PromptModule;
export = AutocompletePrompt;
}
Thanks @pferreir!
inquirer-autocomplete-prompt
: 1.0.1typescript
: 3.5.3inquirer
: 7.0.0@types/inquirer
: 6.5.0
Hi there @pferreir !
Do you have an example of this in action, please ?
I placed your snippet in a types/inquirer-autocomplete-prompt/index.d.ts
file.
I'm trying to register the autocomplete prompt in the following way
import autocomplete from 'inquirer-autocomplete-prompt'
import { Answers, prompt, Question} from 'inquirer';
export class Test {
public constructor () {
prompt.registerPrompt('autocomplete', autocomplete)
}
}
I get the following error :
error TS2345: Argument of type 'PromptModule' is not assignable to parameter of type 'PromptConstructor'.
Type 'PromptModule' provides no match for the signature 'new (question: any, readLine: Interface, answers: Answers): PromptBase'.
Edit
This plugin only supports Inquirer version 5.x. The @types/inquirer
definition started with 6.0.0
. @mokkabonna do you have plans to update this plugin ?
Thanks in advance !
Please create a typings file so Typescript users could enjoy this package. Thanks :)