Skip to content

Commit 327bd8e

Browse files
committed
Update typings
1 parent 04c63d3 commit 327bd8e

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ export type ParsedPatchFileDataType = {
2121
}
2222

2323
export type ParsedPatchType = {
24-
hash: string
25-
authorName: string
26-
authorEmail: string
27-
date: string
28-
message: string
24+
hash?: string
25+
authorName?: string
26+
authorEmail?: string
27+
date?: string
28+
message?: string
2929
files: ParsedPatchFileDataType[]
3030
}
3131

@@ -40,7 +40,7 @@ function parseGitPatch(patch: string) {
4040

4141
if (!gitPatchMetaInfo) return null
4242

43-
const parsedPatch = {
43+
const parsedPatch: ParsedPatchType = {
4444
...gitPatchMetaInfo,
4545
files: [] as ParsedPatchFileDataType[],
4646
}
@@ -149,7 +149,7 @@ function splitMetaInfo(patch: string, lines: string[]) {
149149

150150
if (!match2) return null
151151

152-
const [, authorName,, authorEmail] = match2
152+
const [, authorName, , authorEmail] = match2
153153

154154
const dateLine = lines.shift()
155155

test/index.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ test('is a function', () => {
1717
test('parses a simple patch', () => {
1818
const patchResult = parse(data['one-file.patch'])
1919
const diffResult = parse(data['one-file-diff.patch'])
20+
2021
expect.assertions(2)
2122

2223
const expectResultFiles = [

0 commit comments

Comments
 (0)