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

[types] Module '"../node_modules/enquirer"' has no exported member 'MultiSelect' #212

Open
swyxio opened this issue Oct 5, 2019 · 10 comments · May be fixed by #307
Open

[types] Module '"../node_modules/enquirer"' has no exported member 'MultiSelect' #212

swyxio opened this issue Oct 5, 2019 · 10 comments · May be fixed by #307

Comments

@swyxio
Copy link
Contributor

swyxio commented Oct 5, 2019

hey jon, is there something that broke recently with the types? i cant seem to import MultiSelect. when i import prompt instead and use a type: 'multiselect', the choices field doesnt seem to accept an array. whats the status? i might be able to contribute a fix but just figured i would get a general take of the state of typing in this lib. i had expected it would be first class...

@jonschlinkert
Copy link
Member

hmm, not sure why that's broken, thanks for bringing it to our attention. @doowb can you look into the last release to check for regressions? Could it be as simple as a typo (perhaps casing was changed?)?

i had expected it would be first class...

The sentiment is appreciated, sorry to disappoint. For a whole host of reasons that I'll spare you, I have not personally jumped on the TypeScript bandwagon. However, I'm very open and supportive of contributors adding typings--so PRs would be welcome and appreciated.

@doowb
Copy link
Member

doowb commented Oct 7, 2019

I'll look into it.

@swyxio
Copy link
Contributor Author

swyxio commented Oct 7, 2019

ah ok. then its likely that the typings are out of date and a MultiSelect type never existed. if you confirm i can probably contribuet

@doowb
Copy link
Member

doowb commented Oct 7, 2019

@sw-yx you're right... the MultiSelect type is not in the current typings file. There is this PR that makes a lot of TypeScript changes and adds MultiSelect, as well as, the multiselect value for the type option.

Since there were some conversations going on in the PR, I'm not sure if it's "complete". Would you be able to do a quick review? If it's something that seems acceptable, I can merge it in and update it for anything new that might be missing. (There have been a few other TypeScript PRs focusing on the current index.d.ts file that might be fixed with that PR or can be included afterwards).

Any other contributions are more than welcome :)

@swyxio
Copy link
Contributor Author

swyxio commented Oct 7, 2019

yea that pr seems kinda stale. i’ll copy over what he has and make a fresh one. happy to help! yall know im a fan.

if you dont wanna be bothered by ts issues, the recommendation is actually to let definitelytyped handle it and NOT ship your own typedefs. what do you think about that?

a third way exists as well, creating your typings as a standalone module and having the main module require the typings module. this mainly improves dx by requiring one less install and also is nicer for contributors bc we can sidestep definitelytyped. but its more experimental (basically only kentcdodds does it)

@jonschlinkert
Copy link
Member

jonschlinkert commented Oct 7, 2019 via email

@swyxio
Copy link
Contributor Author

swyxio commented Oct 7, 2019

no really you should consider this:

if you dont wanna be bothered by ts issues, the recommendation is actually to let definitelytyped handle it and NOT ship your own typedefs. what do you think about that?

what's your thought? this affects where I PR types.

@jonschlinkert
Copy link
Member

@doowb and have been chatting about this, I meant to reply earlier. I'd prefer to do whatever would provide the best DX -- but we're leaning towards having it in the project, along with a linting and tests, so that we can more easily ensure that everything stays up-to-date and correct. However, since I'm only superficially familiar with TS, I might be asking too much, since we'd need to rely on someone else to help us maintain it.

It's also worth mentioning that I'm very close to publishing the next major release of Enquirer, which is a complete refactor. All of the same prompts and options will be there, but I made a lot of improvements to internals.

For example, we moved some of the prototype methods into helper functions (called "actions" and "elements"), so that prompts can be more composable. This will also allow mixed content in prompts. So, for example, you'll be able to have a prompt with multiple input fields, some radio buttons, and a checkbox, on a single screen... etc. etc. (There are a few other really exciting features that I'll share when we get closer to release, probably in the next couple of weeks).

In any case, the point is that although most of the API and experience will be the same for end-users, the typings will probably need to be handled differently.

we'd love to get some help with TS for the next release if that's something you're interested in.

@swyxio
Copy link
Contributor Author

swyxio commented Oct 10, 2019

oh i had no idea! nice. yeah the typings would only cover the public facing API so we wouldnt really care about internals. but it does sound like you're changing the public api.

yeah just let me know. i was leaning towards not having the types in here but either way its your call

@a7madgamal
Copy link

I think same is true for
import { Input } from 'enquirer';
works at runtime but TS screams at me 😅

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