[QRQC_2] No implicitAny in twenty-server (#12075)
# Introduction Following https://github.com/twentyhq/twenty/pull/12068 Related with https://github.com/twentyhq/core-team-issues/issues/975 We're enabling `noImplicitAny` handled few use case manually, added a `ts-expect-error` to the others, we should plan to handle them in the future
This commit is contained in:
@ -122,6 +122,7 @@ export class EntitySchemaColumnFactory {
|
||||
);
|
||||
const columnType = fieldMetadataTypeToColumnType(compositeProperty.type);
|
||||
const defaultValue = serializeDefaultValue(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
fieldMetadata.defaultValue?.[compositeProperty.name],
|
||||
);
|
||||
|
||||
|
||||
@ -16,15 +16,20 @@ export class ScopedWorkspaceContextFactory {
|
||||
isExecutedByApiKey: boolean;
|
||||
} {
|
||||
const workspaceId: string | undefined =
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
this.request?.['req']?.['workspaceId'] ||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
this.request?.['params']?.['workspaceId'];
|
||||
const workspaceMetadataVersion: number | undefined =
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
this.request?.['req']?.['workspaceMetadataVersion'];
|
||||
|
||||
return {
|
||||
workspaceId: workspaceId ?? null,
|
||||
workspaceMetadataVersion: workspaceMetadataVersion ?? null,
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
userWorkspaceId: this.request?.['req']?.['userWorkspaceId'] ?? null,
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
isExecutedByApiKey: !!this.request?.['req']?.['apiKey'],
|
||||
};
|
||||
}
|
||||
|
||||
@ -63,17 +63,20 @@ export function formatResult<T>(
|
||||
|
||||
if (!compositePropertyArgs && !isRelation) {
|
||||
if (isPlainObject(value)) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[key] = formatResult(
|
||||
value,
|
||||
objectMetadataItemWithFieldMaps,
|
||||
objectMetadataMaps,
|
||||
);
|
||||
} else if (objectMetadaItemFieldsByName[key]) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[key] = formatFieldMetadataValue(
|
||||
value,
|
||||
objectMetadaItemFieldsByName[key],
|
||||
);
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[key] = value;
|
||||
}
|
||||
|
||||
@ -96,6 +99,7 @@ export function formatResult<T>(
|
||||
);
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[key] = formatResult(
|
||||
value,
|
||||
targetObjectMetadata,
|
||||
@ -109,10 +113,13 @@ export function formatResult<T>(
|
||||
|
||||
const { parentField, ...compositeProperty } = compositePropertyArgs;
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
if (!newData[parentField]) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[parentField] = {};
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[parentField][compositeProperty.name] = value;
|
||||
}
|
||||
|
||||
@ -135,6 +142,7 @@ export function formatResult<T>(
|
||||
new Date().getTimezoneOffset() * 60 * 1000;
|
||||
|
||||
for (const dateFieldMetadata of dateFieldMetadataCollection) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const rawUpdatedDate = newData[dateFieldMetadata.name] as
|
||||
| string
|
||||
| null
|
||||
@ -152,9 +160,11 @@ export function formatResult<T>(
|
||||
serverOffsetInMillisecondsToCounterActTypeORMAutomaticTimezoneShift,
|
||||
);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[dateFieldMetadata.name] = shiftedDate;
|
||||
}
|
||||
} else if (isNonEmptyString(rawUpdatedDate)) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const currentDate = new Date(newData[dateFieldMetadata.name]);
|
||||
|
||||
const shiftedDate = new Date(
|
||||
@ -162,6 +172,7 @@ export function formatResult<T>(
|
||||
serverOffsetInMillisecondsToCounterActTypeORMAutomaticTimezoneShift,
|
||||
);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[dateFieldMetadata.name] = shiftedDate;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user