node-gitlog icon indicating copy to clipboard operation
node-gitlog copied to clipboard

Should add more fields?

Open FishOrBear opened this issue 5 years ago • 4 comments

image

image

image

FishOrBear avatar Apr 09 '20 06:04 FishOrBear

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

hipstersmoothie avatar Apr 09 '20 15:04 hipstersmoothie

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

const commits = gitlog(options);

hipstersmoothie avatar Apr 09 '20 15:04 hipstersmoothie


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

const commits = gitlog(options);

Can be entered directly without the need for generics

FishOrBear avatar Apr 10 '20 00:04 FishOrBear

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);

hipstersmoothie avatar Apr 10 '20 02:04 hipstersmoothie