Skip to content

Commit ba3b829

Browse files
author
Iurii Golovinskii
committed
review, fixed types
1 parent 00b99ec commit ba3b829

File tree

4 files changed

+7
-23
lines changed

4 files changed

+7
-23
lines changed

src/types/external/comparison.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export interface ResolvedComparisonSummary {
4545
operationTypes: OperationType[]
4646
}
4747

48-
export interface OperationType<T extends string | number | symbol = DiffType> {
48+
export interface OperationType<T extends DiffType | DiffTypeDto = DiffType> {
4949
apiType: OperationsApiType
5050
changesSummary: ChangeSummary<T>
5151
numberOfImpactedOperations: ChangeSummary<T>
@@ -61,7 +61,7 @@ export const DEPRECATED_CHANGE_TYPE = deprecated
6161
export const ANNOTATION_CHANGE_TYPE = annotation
6262
export const SEMI_BREAKING_CHANGE_TYPE = 'semi-breaking'
6363

64-
export type ChangeSummary<T extends string | number | symbol = DiffType> = Record<T, number>
64+
export type ChangeSummary<T extends DiffType | DiffTypeDto = DiffType> = Record<T, number>
6565
export type ImpactedOperationSummary = Record<DiffType, boolean>
6666
export const DIFF_TYPES: DiffType[] = Object.values(ClassifierType)
6767

src/utils/transformToDto.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ export function toVersionsComparisonDto({
162162
}
163163

164164
export function convertDtoFieldOperationTypes<
165-
T extends string | number | symbol = DiffTypeDto,
166-
J extends string | number | symbol = DiffType>
165+
T extends DiffTypeDto | DiffType = DiffTypeDto,
166+
J extends DiffTypeDto | DiffType = DiffType>
167167
(operationTypes: ReadonlyArray<OperationType<T>>, {
168168
origin,
169169
override,
@@ -184,8 +184,8 @@ export function convertDtoFieldOperationTypes<
184184
}
185185

186186
export function replacePropertyInChangesSummary<
187-
T extends string | number | symbol = DiffTypeDto,
188-
J extends string | number | symbol = DiffType>
187+
T extends DiffTypeDto | DiffType = DiffTypeDto,
188+
J extends DiffTypeDto | DiffType = DiffType>
189189
(obj: ChangeSummary<T>,
190190
{
191191
origin,

test/performance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ await portal.publish('performance', {
4444
{ fileId: '2024.1/openapi_large_x6.yaml' },
4545
],
4646
})
47-
console.log('DONE')
47+
console.log('DONE')

test/risky-changes.test.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,10 @@ describe('Risky changes test', () => {
5454

5555
expect(result).toEqual(changesSummaryMatcher({
5656
[NON_BREAKING_CHANGE_TYPE]: 1,
57-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
58-
// @ts-ignore
5957
[RISKY_CHANGE_TYPE]: 1,
6058
}))
6159
expect(result).toEqual(numberOfImpactedOperationsMatcher({
6260
[NON_BREAKING_CHANGE_TYPE]: 1,
63-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
64-
// @ts-ignore
6561
[RISKY_CHANGE_TYPE]: 1,
6662
}))
6763
})
@@ -100,14 +96,10 @@ describe('Risky changes test', () => {
10096

10197
expect(result).toEqual(changesSummaryMatcher({
10298
[BREAKING_CHANGE_TYPE]: 1,
103-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
104-
// @ts-ignore
10599
[RISKY_CHANGE_TYPE]: 1,
106100
}))
107101
expect(result).toEqual(numberOfImpactedOperationsMatcher({
108102
[BREAKING_CHANGE_TYPE]: 1,
109-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
110-
// @ts-ignore
111103
[RISKY_CHANGE_TYPE]: 1,
112104
}))
113105
})
@@ -143,13 +135,9 @@ describe('Risky changes test', () => {
143135
const result = await editor.run()
144136

145137
expect(result).toEqual(changesSummaryMatcher({
146-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
147-
// @ts-ignore
148138
[RISKY_CHANGE_TYPE]: 2,
149139
}))
150140
expect(result).toEqual(numberOfImpactedOperationsMatcher({
151-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
152-
// @ts-ignore
153141
[RISKY_CHANGE_TYPE]: 2,
154142
}))
155143
})
@@ -185,14 +173,10 @@ describe('Risky changes test', () => {
185173
const result = await editor.run()
186174

187175
expect(result).toEqual(changesSummaryMatcher({
188-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
189-
// @ts-ignore
190176
[RISKY_CHANGE_TYPE]: 3,
191177
[NON_BREAKING_CHANGE_TYPE]: 1,
192178
}))
193179
expect(result).toEqual(numberOfImpactedOperationsMatcher({
194-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
195-
// @ts-ignore
196180
[RISKY_CHANGE_TYPE]: 1,
197181
[NON_BREAKING_CHANGE_TYPE]: 1,
198182
}))

0 commit comments

Comments
 (0)