Skip to content

Conversation

@auguwu
Copy link

@auguwu auguwu commented Nov 6, 2021

This PR is basically a small modification to the typings of this package, I basically added 2 new types to help TypeScript users define the arg specification more clearly.

Right now, you would need to define an interface prefixed with -- which is not common at all when writing interfaces:

import arg from 'arg';

interface CliArgs extends arg.Spec {
  '--key': string;
}

arg<CliArgs>({
  // Success!
  '--key': String
});

In this PR, this basically converts all the keys from the T generic from the default exports prefixed with dashes:

import arg from 'arg';

interface CliArgs extends arg.Spec {
  key: string;
}

arg<CliArgs>({
  // Success!
  '--key': String
});

Sorry for the bad writing, I'm not really good at explaining what I did within PRs (since I'm not usually a contributor on most repositories.)

Copy link
Contributor

@Qix- Qix- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Man it is so incredibly weird how specific you can make Typescript. This is really cool, thanks.

I unfortunately do not have control over this repository anymore and can only approve and hope one of the Vercel staff see this and merge/publish a new minor version (please?).

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.

2 participants