mokkabonna / inquirer-autocomplete-prompt

Autocomplete prompt for inquirer
ISC License
354 stars 82 forks source link

Could not find a declaration file for module 'inquirer-autocomplete-prompt #86

Closed waldoplus closed 5 years ago

waldoplus commented 5 years ago

inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'))

I get this error in the editor: "Could not find a declaration file for module 'inquirer-autocomplete-prompt'. '/Users/lando/Documents/Code/nt-cli/node_modules/inquirer-autocomplete-prompt/index.js' implicitly has an 'any' type."

When I try to run my inquirer script, it works up until I get to the autocomplete prompt then hangs.

` const inquirer = require('inquirer') var _ = require('lodash') inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt')) var foods = ['Apple', 'Orange', 'Banana', 'Kiwi', 'Lichi', 'Grapefruit'];

function searchFood(answers, input) { input = input || '' return new Promise(function(resolve) { setTimeout(function() { var fuzzyResult = fuzzy.filter(input, foods) resolve( fuzzyResult.map(function(el) { return el.original }) ) }, _.random(30, 500)) }) }

program .command('add') .alias('a') .action(() => { inquirer .prompt([ { message: 'What is the note name?', type: 'input', name: 'name', validate: function checkForDuplicates(name) { return Note.findOne({name : name}) .then(note => note ? 'Note already exists' : true) }, }, { message: 'Please enter the content', type: 'input', name: 'content', }, { type: 'autocomplete', name: 'fruit', suggestOnly: true, message: 'What is your favorite fruit?', source: searchFood, pageSize: 4, validate: function(val) { return val ? true : 'Type something!' }, }, ])`

waldoplus commented 5 years ago

nevermind. didn't have reference to fuzzy. not sure about the typings problem as this is a js project not ts...probably something to do with vscode