fix(history): update type (#19878)

This commit is contained in:
markkaylor 2024-03-21 17:02:13 +01:00 committed by GitHub
parent c4ec62a341
commit c184e9d81f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,5 @@
import { difference, omit } from 'lodash/fp'; import { difference, omit } from 'lodash/fp';
import { Schema } from '@strapi/types'; import type { Struct } from '@strapi/types';
import { CreateHistoryVersion } from '../../../../shared/contracts/history-versions'; import { CreateHistoryVersion } from '../../../../shared/contracts/history-versions';
import { FIELDS_TO_IGNORE } from '../constants'; import { FIELDS_TO_IGNORE } from '../constants';
@ -9,13 +9,10 @@ import { FIELDS_TO_IGNORE } from '../constants';
*/ */
export const getSchemaAttributesDiff = ( export const getSchemaAttributesDiff = (
versionSchemaAttributes: CreateHistoryVersion['schema'], versionSchemaAttributes: CreateHistoryVersion['schema'],
contentTypeSchemaAttributes: Schema.Attributes contentTypeSchemaAttributes: Struct.SchemaAttributes
) => { ) => {
// Omit the same fields that were omitted when creating a history version // Omit the same fields that were omitted when creating a history version
const sanitizedContentTypeSchemaAttributes = omit( const sanitizedContentTypeSchemaAttributes = omit(FIELDS_TO_IGNORE, contentTypeSchemaAttributes);
FIELDS_TO_IGNORE,
contentTypeSchemaAttributes
) as CreateHistoryVersion['schema'];
const reduceDifferenceToAttributesObject = ( const reduceDifferenceToAttributesObject = (
diffKeys: string[], diffKeys: string[],