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

Add strong typing of .opts() using generics #1539

Merged
merged 1 commit into from May 30, 2021

Conversation

shadowspawn
Copy link
Collaborator

@shadowspawn shadowspawn commented May 30, 2021

Pull Request

Problem

Unable to specify .opts() return type in TypeScript client code.

Issue: #1536

Original Pull Request: #1537 (manually moved code between branches, with co-author credit on commit)

Solution

Add generics so can call like:

interface MyCheeseOption {
  cheese: string;
}
const myCheeseOption = program.opts<MyCheeseOption>();

ChangeLog

  • add client typing of .opts() return type using TypeScript generics

Co-authored-by: tyankatsu <frips.ryilsufupe+dev@gmail.com>
Copy link
Collaborator

@abetomo abetomo left a comment

👍

@shadowspawn shadowspawn merged commit 03d2147 into tj:release/8.x May 30, 2021
12 checks passed
@shadowspawn shadowspawn deleted the feature/generics-for-opts branch May 30, 2021
@shadowspawn shadowspawn added this to the v8.0.0 milestone May 30, 2021
@shadowspawn shadowspawn added the pending release label May 30, 2021
@shadowspawn shadowspawn removed the pending release label Jun 25, 2021
@shadowspawn
Copy link
Collaborator Author

shadowspawn commented Aug 14, 2022

For some experimental strong inferred typing see: https://github.com/commander-js/extra-typings

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 this pull request may close these issues.

None yet

2 participants