-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
Update typescript definitions (BREAK CHANGES) #82
base: master
Are you sure you want to change the base?
Conversation
Nice work! We're reviewing the code. I'm still learning typescript, so feedback from others would be great as well. Thanks! |
@kamontat Good job! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job!
I have a question: all the methods of the Prompt
have the ThisType
and they point to this
. Are they necessary?
Also, can you add tests? Test files are located at test/types/test.ts
. Thanks.
declare namespace EnquirerStatic { | ||
namespace Caller { | ||
type NoParam<R> = () => R; | ||
type OneParam<T, R = T> = (value: T) => R; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the default type of the type parameter R
is T
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The R
is for the return but I set as an optional since somethings the method will return as the same as input
index.d.ts
Outdated
| (PromptOptions | ((this: Enquirer) => PromptOptions))[] | ||
): Promise<T>; | ||
declare namespace EnquirerStatic { | ||
namespace Caller { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can merge Caller
with UnionType
namespace as a new namespace called TypeUtils
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
NumberOptions<N> {} | ||
} | ||
|
||
type PromptOptions<N extends string> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enquirer allows custom prompt, not only built-in prompts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already add support to custom prompt, but the prompt must extend BaseTypeOptions
I will try to solve it problem, but I have another work at least until end of the year. so... |
@g-plane @jonschlinkert after end of this year, can you notify me again, otherwise I may forget about this project. |
@kamontat Are you still active on this? |
Yes, sorry for late update. |
What is the status of this PR? I'm looking for TS definitions and it seems pointless writing my own if these definitions work |
This is working, but not 100% |
Can this be made a priority? TS defintion support is the standard nowadays, wouldn't be a bad idea either to convert this project to TS |
@kamontat What's the progress now? Are you still active on this? |
Hey friends, what is needed to progress this forward? If there's something concrete that needs to happen, can you enumerate it? Getting some of these types corrected would be a great help |
@cdaringe There are a lot changes since last time I working on this PR (both enquirer and Typescript). There are a lot of Typescript definitions open on this repository. |
I update the typescript definitions to support almost every feature in Enquirer.
Features
Prompt
object for custom promptEnquirer
class for instance createdType
for casting (in some case)Auto completion
Result Auto completion
Todo