Skip to content

Commit 7218b94

Browse files
committed
fix: fix type problem
1 parent e0cb5db commit 7218b94

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/split/SplitLine.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script setup lang="ts">
22
import { DiffType } from '../types'
3-
import type { SplitDiffLine } from '../types'
3+
import type { SplitLineChange } from '../types'
44
55
const props = defineProps<{
6-
splitLine: SplitDiffLine
6+
splitLine: SplitLineChange
77
}>()
88
99
const getCodeMarker = (type: DiffType) => {

src/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ export interface DiffLine {
1111
num?: number
1212
}
1313

14-
export interface SplitDiffLine {
14+
export interface SplitLineChange {
1515
fold?: boolean
1616
left: DiffLine
1717
right: DiffLine
1818
}
1919

20-
export interface UnifiedLine {
20+
export interface UnifiedLineChange {
2121
fold?: boolean
2222
type: DiffType
2323
code: string
@@ -30,11 +30,11 @@ export interface DiffStat {
3030
deletionsNum: number
3131
}
3232
export interface SplitViewerChange {
33-
changes: SplitDiffLine[]
33+
changes: SplitLineChange[]
3434
stat: DiffStat
3535
}
3636

3737
export interface UnifiedViewerChange {
38-
changes: UnifiedLine[]
38+
changes: UnifiedLineChange[]
3939
stat: DiffStat
4040
}

src/unified/UnifiedLine.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script lang="ts" setup>
2-
import type { UnifiedLine } from '../types'
2+
import type { UnifiedLineChange } from '../types'
33
import { DiffType } from '../types'
44
55
const props = defineProps<{
6-
line: UnifiedLine
6+
line: UnifiedLineChange
77
}>()
88
99
const getCodeMarker = (type: DiffType) => {

src/unified/UnifiedViewer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script setup lang="ts">
2-
import type { UnifiedViewerChange } from '../types'
2+
import type { UnifiedLineChange } from '../types'
33
import UnifiedLine from './UnifiedLine.vue'
44
55
const props = defineProps<{
6-
diffChange: UnifiedViewerChange
6+
diffChange: UnifiedLineChange[]
77
}>()
88
</script>
99

src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Change } from 'diff'
33
import { DIFF_DELETE, DIFF_INSERT, diff_match_patch as DiffMatchPatch } from 'diff-match-patch'
44
import hljs from './highlight'
55
import { DiffType } from './types'
6-
import type { DiffLine, DiffStat, SplitDiffLine, SplitViewerChange, UnifiedLine, UnifiedViewerChange } from './types'
6+
import type { DiffLine, DiffStat, SplitLineChange, SplitViewerChange, UnifiedLineChange, UnifiedViewerChange } from './types'
77

88
const MODIFIED_START_TAG = '<code-diff-modified>'
99
const MODIFIED_CLOSE_TAG = '</code-diff-modified>'
@@ -165,7 +165,7 @@ export function createSplitDiff(
165165
let addNum = 0
166166
let skip = false
167167

168-
const rawChanges: SplitDiffLine[] = []
168+
const rawChanges: SplitLineChange[] = []
169169
const result: SplitViewerChange = {
170170
changes: rawChanges,
171171
stat: calcDiffStat(changes),
@@ -330,7 +330,7 @@ export function createUnifiedDiff(
330330
let addNum = 0
331331
let skip = false
332332

333-
const rawChanges: UnifiedLine[] = []
333+
const rawChanges: UnifiedLineChange[] = []
334334
const result: UnifiedViewerChange = {
335335
changes: rawChanges,
336336
stat: calcDiffStat(changes),

0 commit comments

Comments
 (0)