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

Should add more fields? #50

Open
FishOrBear opened this issue Apr 9, 2020 · 4 comments
Open

Should add more fields? #50

FishOrBear opened this issue Apr 9, 2020 · 4 comments

Comments

@FishOrBear
Copy link
Contributor

image

image

image

@FishOrBear FishOrBear changed the title Should I add more fields? Should add more fields? Apr 9, 2020
@hipstersmoothie
Copy link
Collaborator

I'm not quite sure what you're asking for

@hipstersmoothie
Copy link
Collaborator

const options: GitlogOptions<("subject" | "authorName" | "authorDate")[]> = {
  repo: "foo",
  fields: ["subject", "authorName", "authorDate"],
};

const commits = gitlog(options);

@FishOrBear
Copy link
Contributor Author


const options: GitlogOptions = {
  repo: "foo",
  fields: ["treeHash"],
};

const commits = gitlog(options);

Can be entered directly without the need for generics

@hipstersmoothie
Copy link
Collaborator

the only problem is that in typescript we can't ensure commits has the right fields without the generic.

How do you like

const options = {
  repo: "foo",
  fields: ["subject", "authorName", "authorDate"] as const,
};

gitlog(options);

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

No branches or pull requests

2 participants