[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:
@ -16,7 +16,9 @@ const generateRandomAmountMicros = () => {
|
||||
return firstDigit * 10000000000;
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const generateOpportunities = (companies) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return companies.map((company) => ({
|
||||
id: v4(),
|
||||
name: company.name,
|
||||
@ -66,6 +68,7 @@ export const seedOpportunityWithDemoData = async (
|
||||
])
|
||||
.orIgnore()
|
||||
.values(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
opportunities.map((opportunity, index) => ({
|
||||
...opportunity,
|
||||
position: index,
|
||||
|
||||
@ -16,9 +16,11 @@ export const seedWorkspaceWithDemoData = async (
|
||||
objectMetadata: ObjectMetadataEntity[],
|
||||
) => {
|
||||
const objectMetadataMap = objectMetadata.reduce((acc, object) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[object.standardId ?? ''] = {
|
||||
id: object.id,
|
||||
fields: object.fields.reduce((acc, field) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[field.standardId ?? ''] = field.id;
|
||||
|
||||
return acc;
|
||||
|
||||
@ -18,6 +18,7 @@ export const standardObjectsPrefillData = async (
|
||||
throw new Error('Standard Id is not set for object: ${object.name}');
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[object.standardId] = {
|
||||
id: object.id,
|
||||
fields: object.fields.reduce((acc, field) => {
|
||||
@ -25,6 +26,7 @@ export const standardObjectsPrefillData = async (
|
||||
throw new Error('Standard Id is not set for field: ${field.name}');
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[field.standardId] = field.id;
|
||||
|
||||
return acc;
|
||||
|
||||
@ -134,6 +134,7 @@ export class WorkspaceDefaultValueFixer extends AbstractWorkspaceFixer<Workspace
|
||||
continue;
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const value = currentDefaultValue[key];
|
||||
|
||||
const newValue =
|
||||
|
||||
@ -303,7 +303,8 @@ export class DatabaseStructureService {
|
||||
normalizer(
|
||||
compositeProperty.type,
|
||||
typeof initialDefaultValue === 'object'
|
||||
? initialDefaultValue?.[compositeProperty.name]
|
||||
? // @ts-expect-error legacy noImplicitAny
|
||||
initialDefaultValue?.[compositeProperty.name]
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
||||
@ -18,9 +18,11 @@ describe('WorkspaceRelationComparator', () => {
|
||||
}
|
||||
|
||||
it('should generate CREATE action for new relations', () => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const original = [];
|
||||
const standard = [createMockRelationMetadata({})];
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const result = comparator.compare(original, standard);
|
||||
|
||||
expect(result).toEqual([
|
||||
@ -36,8 +38,10 @@ describe('WorkspaceRelationComparator', () => {
|
||||
|
||||
it('should generate DELETE action for removed relations', () => {
|
||||
const original = [createMockRelationMetadata({ id: '1' })];
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const standard = [];
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const result = comparator.compare(original, standard);
|
||||
|
||||
expect(result).toEqual([
|
||||
|
||||
@ -51,10 +51,12 @@ export function transformMetadataForComparison<T, Keys extends keyof T>(
|
||||
) {
|
||||
const orderedValue = orderObjectProperties(datum[property] as object);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
transformedField[property as string] = JSON.stringify(
|
||||
orderedValue,
|
||||
) as T[Keys];
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
transformedField[property as string] = datum[property];
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,8 +183,10 @@ export class WorkspaceFieldRelationComparator {
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
propertiesMap[fieldId][property] = newValue;
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
propertiesMap[fieldId][property] = difference.value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,10 +191,12 @@ export class WorkspaceFieldComparator {
|
||||
if (
|
||||
(fieldPropertiesToStringify as readonly string[]).includes(property)
|
||||
) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
fieldPropertiesToUpdateMap[id][property] = this.parseJSONOrString(
|
||||
difference.value,
|
||||
);
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
fieldPropertiesToUpdateMap[id][property] = difference.value;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -74,6 +74,7 @@ export class WorkspaceObjectComparator {
|
||||
|
||||
const property = difference.path[0];
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
objectPropertiesToUpdate[property] = standardObjectMetadata[property];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user