@@ -13,13 +13,13 @@ export const COMPARE_SCOPE_ROOT: CompareScope = 'root'
1313/**
1414 * Diff should be unique by [type, beforeDeclarationPaths, afterDeclarationPaths, scope]
1515 */
16- interface DiffBase {
17- type : DiffType
16+ interface DiffBase < T > {
17+ type : T
1818 scope : CompareScope
1919 description ?: string
2020}
2121
22- export interface DiffAdd extends DiffBase {
22+ export interface DiffAdd < T = DiffType > extends DiffBase < T > {
2323 action : typeof DiffAction . add
2424 /**
2525 * declaration path in after document. Empty array can be if value doesn't exist in 'after' spec or value have synthetic origin
@@ -29,7 +29,7 @@ export interface DiffAdd extends DiffBase {
2929 afterNormalizedValue : unknown
3030}
3131
32- export interface DiffRemove extends DiffBase {
32+ export interface DiffRemove < T = DiffType > extends DiffBase < T > {
3333 action : typeof DiffAction . remove
3434 /**
3535 * declaration path in before document. Empty array can be if value doesn't exist in 'before' spec or value have synthetic origin
@@ -39,7 +39,7 @@ export interface DiffRemove extends DiffBase {
3939 beforeNormalizedValue : unknown
4040}
4141
42- export interface DiffReplace extends DiffBase {
42+ export interface DiffReplace < T = DiffType > extends DiffBase < T > {
4343 action : typeof DiffAction . replace
4444 /**
4545 * declaration path in before document. Empty array can be if value doesn't exist in 'before' spec or value have synthetic origin
@@ -55,7 +55,7 @@ export interface DiffReplace extends DiffBase {
5555 beforeNormalizedValue : unknown
5656}
5757
58- export interface DiffRename extends DiffBase {
58+ export interface DiffRename < T = DiffType > extends DiffBase < T > {
5959 action : typeof DiffAction . rename
6060 /**
6161 * declaration path in before document. Empty array can be if value doesn't exist in 'before' spec or value have synthetic origin
@@ -69,7 +69,7 @@ export interface DiffRename extends DiffBase {
6969 beforeKey : unknown
7070}
7171
72- export type Diff = DiffAdd | DiffRemove | DiffReplace | DiffRename
72+ export type Diff < T = DiffType > = DiffAdd < T > | DiffRemove < T > | DiffReplace < T > | DiffRename < T >
7373
7474export interface CompareResult {
7575 diffs : Diff [ ]
0 commit comments