[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:
@ -26,12 +26,15 @@ export class MicrosoftEmailAliasManagerService {
|
||||
|
||||
const handleAliases =
|
||||
proxyAddresses
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
?.filter((address) => {
|
||||
return address.startsWith('SMTP:') === false;
|
||||
})
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.map((address) => {
|
||||
return address.replace('smtp:', '').toLowerCase();
|
||||
})
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.filter((address) => {
|
||||
return address !== '';
|
||||
}) || [];
|
||||
|
||||
@ -21,6 +21,7 @@ describe('Email Alias Manager Service', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
connectedAccountRepository = {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
update: jest.fn().mockResolvedValue((arg) => arg),
|
||||
};
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ export function filterOutSelfAndContactsFromCompanyOrWorkspace(
|
||||
|
||||
const workspaceMembersMap = workspaceMembers.reduce(
|
||||
(map, workspaceMember) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
map[workspaceMember.userEmail.toLowerCase()] = true;
|
||||
|
||||
return map;
|
||||
@ -36,6 +37,7 @@ export function filterOutSelfAndContactsFromCompanyOrWorkspace(
|
||||
(contact) =>
|
||||
(isDifferentDomain(contact, selfDomainName) ||
|
||||
!isWorkDomain(selfDomainName)) &&
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
!workspaceMembersMap[contact.handle.toLowerCase()] &&
|
||||
!allHandles.includes(contact.handle.toLowerCase()),
|
||||
);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
import psl from 'psl';
|
||||
import { capitalize } from 'twenty-shared/utils';
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
import psl from 'psl';
|
||||
|
||||
export const getDomainNameFromHandle = (handle: string): string => {
|
||||
|
||||
@ -77,6 +77,7 @@ export class GmailGetMessageListService {
|
||||
firstMessageExternalId = messageList.data.messages?.[0].id ?? undefined;
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
messageExternalIds.push(...messages.map((message) => message.id));
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { gmail_v1 as gmailV1 } from 'googleapis';
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
import planer from 'planer';
|
||||
|
||||
import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';
|
||||
|
||||
@ -91,14 +91,17 @@ export class MicrosoftGetMessagesService {
|
||||
'from',
|
||||
),
|
||||
...formatAddressObjectAsParticipants(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
response?.toRecipients?.map((recipient) => recipient.emailAddress),
|
||||
'to',
|
||||
),
|
||||
...formatAddressObjectAsParticipants(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
response?.ccRecipients?.map((recipient) => recipient.emailAddress),
|
||||
'cc',
|
||||
),
|
||||
...formatAddressObjectAsParticipants(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
response?.bccRecipients?.map((recipient) => recipient.emailAddress),
|
||||
'bcc',
|
||||
),
|
||||
|
||||
@ -175,34 +175,38 @@ export class TimelineActivityService {
|
||||
if (activityTargets.length === 0) return;
|
||||
if (activity.length === 0) return;
|
||||
|
||||
return activityTargets
|
||||
.map((activityTarget) => {
|
||||
const targetColumn: string[] = Object.entries(activityTarget)
|
||||
.map(([columnName, columnValue]: [string, string]) => {
|
||||
if (
|
||||
columnName === activityType + 'Id' ||
|
||||
!columnName.endsWith('Id')
|
||||
)
|
||||
return;
|
||||
if (columnValue === null) return;
|
||||
return (
|
||||
activityTargets
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.map((activityTarget) => {
|
||||
const targetColumn: string[] = Object.entries(activityTarget)
|
||||
.map(([columnName, columnValue]: [string, string]) => {
|
||||
if (
|
||||
columnName === activityType + 'Id' ||
|
||||
!columnName.endsWith('Id')
|
||||
)
|
||||
return;
|
||||
if (columnValue === null) return;
|
||||
|
||||
return columnName;
|
||||
})
|
||||
.filter((column): column is string => column !== undefined);
|
||||
return columnName;
|
||||
})
|
||||
.filter((column): column is string => column !== undefined);
|
||||
|
||||
if (targetColumn.length === 0) return;
|
||||
if (targetColumn.length === 0) return;
|
||||
|
||||
return {
|
||||
...event,
|
||||
name: 'linked-' + eventName,
|
||||
objectName: targetColumn[0].replace(/Id$/, ''),
|
||||
recordId: activityTarget[targetColumn[0]],
|
||||
linkedRecordCachedName: activity[0].title,
|
||||
linkedRecordId: activity[0].id,
|
||||
linkedObjectMetadataId: event.objectMetadata.id,
|
||||
} satisfies TimelineActivity;
|
||||
})
|
||||
.filter((event): event is TimelineActivity => event !== undefined);
|
||||
return {
|
||||
...event,
|
||||
name: 'linked-' + eventName,
|
||||
objectName: targetColumn[0].replace(/Id$/, ''),
|
||||
recordId: activityTarget[targetColumn[0]],
|
||||
linkedRecordCachedName: activity[0].title,
|
||||
linkedRecordId: activity[0].id,
|
||||
linkedObjectMetadataId: event.objectMetadata.id,
|
||||
} satisfies TimelineActivity;
|
||||
})
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.filter((event): event is TimelineActivity => event !== undefined)
|
||||
);
|
||||
}
|
||||
|
||||
private async computeActivityTargets({
|
||||
|
||||
@ -35,6 +35,7 @@ export class ViewService {
|
||||
);
|
||||
|
||||
for (const viewId of viewsIds) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const position = positions?.[viewId];
|
||||
const newFieldInThisView = await viewFieldRepository.findBy({
|
||||
fieldMetadataId: fieldId,
|
||||
|
||||
@ -9,6 +9,7 @@ const companyMockObjectMetadataItem = mockObjectMetadataItemsWithFieldMaps.find(
|
||||
)!;
|
||||
|
||||
describe('generateFakeFormResponse', () => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
let objectMetadataRepository;
|
||||
|
||||
beforeEach(() => {
|
||||
@ -52,6 +53,7 @@ describe('generateFakeFormResponse', () => {
|
||||
const result = await generateFakeFormResponse({
|
||||
formMetadata: schema,
|
||||
workspaceId: '1',
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
objectMetadataRepository,
|
||||
});
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ export const generateFakeField = ({
|
||||
icon: icon,
|
||||
label: label,
|
||||
value: compositeType.properties.reduce((acc, property) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[property.name] = {
|
||||
isLeaf: true,
|
||||
type: property.type,
|
||||
|
||||
@ -572,7 +572,9 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
|
||||
const enrichedResponses = await Promise.all(
|
||||
responseKeys.map(async (key) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
if (!isDefined(response[key])) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return { key, value: response[key] };
|
||||
}
|
||||
|
||||
@ -581,7 +583,9 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
if (
|
||||
field?.type === 'RECORD' &&
|
||||
field?.settings?.objectName &&
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
isDefined(response[key].id) &&
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
isValidUuid(response[key].id)
|
||||
) {
|
||||
const repository = await this.twentyORMManager.getRepository(
|
||||
@ -589,17 +593,20 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
);
|
||||
|
||||
const record = await repository.findOne({
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
where: { id: response[key].id },
|
||||
});
|
||||
|
||||
return { key, value: record };
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return { key, value: response[key] };
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
return enrichedResponses.reduce((acc, { key, value }) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[key] = value;
|
||||
|
||||
return acc;
|
||||
|
||||
@ -49,6 +49,7 @@ const resolveObject = (
|
||||
const entries = Object.entries(resolvedObject);
|
||||
|
||||
for (const [key, value] of entries) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
resolvedObject[key] = resolveInput(value, context);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user