mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-08 01:15:49 +02:00
chore: remove @ts-ignore-error (#3629)
This commit is contained in:
parent
2010e5d345
commit
596d7543e5
@ -362,24 +362,23 @@ export default class ExportImportService {
|
|||||||
const unsupportedContextFields = await this.getUnsupportedContextFields(
|
const unsupportedContextFields = await this.getUnsupportedContextFields(
|
||||||
dto,
|
dto,
|
||||||
);
|
);
|
||||||
if (
|
if (Array.isArray(unsupportedContextFields)) {
|
||||||
Array.isArray(unsupportedContextFields) &&
|
const [firstError, ...remainingErrors] =
|
||||||
unsupportedContextFields.length > 0
|
unsupportedContextFields.map((field) => {
|
||||||
) {
|
|
||||||
throw new UnleashError({
|
|
||||||
name: 'BadDataError',
|
|
||||||
message:
|
|
||||||
'Some of the context fields you are trying to import are not supported.',
|
|
||||||
// @ts-ignore-error We know that the array contains at least one
|
|
||||||
// element here.
|
|
||||||
details: unsupportedContextFields.map((field) => {
|
|
||||||
const description = `${field.name} is not supported.`;
|
const description = `${field.name} is not supported.`;
|
||||||
return {
|
return {
|
||||||
description,
|
description,
|
||||||
message: description,
|
message: description,
|
||||||
};
|
};
|
||||||
}),
|
});
|
||||||
});
|
if (firstError !== undefined) {
|
||||||
|
throw new UnleashError({
|
||||||
|
name: 'BadDataError',
|
||||||
|
message:
|
||||||
|
'Some of the context fields you are trying to import are not supported.',
|
||||||
|
details: [firstError, ...remainingErrors],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,21 +449,23 @@ export default class ExportImportService {
|
|||||||
|
|
||||||
private async verifyStrategies(dto: ImportTogglesSchema) {
|
private async verifyStrategies(dto: ImportTogglesSchema) {
|
||||||
const unsupportedStrategies = await this.getUnsupportedStrategies(dto);
|
const unsupportedStrategies = await this.getUnsupportedStrategies(dto);
|
||||||
if (unsupportedStrategies.length > 0) {
|
|
||||||
|
const [firstError, ...remainingErrors] = unsupportedStrategies.map(
|
||||||
|
(strategy) => {
|
||||||
|
const description = `${strategy.name} is not supported.`;
|
||||||
|
|
||||||
|
return {
|
||||||
|
description,
|
||||||
|
message: description,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (firstError !== undefined) {
|
||||||
throw new UnleashError({
|
throw new UnleashError({
|
||||||
name: 'BadDataError',
|
name: 'BadDataError',
|
||||||
message:
|
message:
|
||||||
'Some of the strategies you are trying to import are not supported.',
|
'Some of the strategies you are trying to import are not supported.',
|
||||||
// @ts-ignore-error We know that the array contains at least one
|
details: [firstError, ...remainingErrors],
|
||||||
// element here.
|
|
||||||
details: unsupportedStrategies.map((strategy) => {
|
|
||||||
const description = `${strategy.name} is not supported.`;
|
|
||||||
|
|
||||||
return {
|
|
||||||
description,
|
|
||||||
message: description,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user