[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:
+8
@@ -5,6 +5,7 @@ import {
|
||||
} from 'src/engine/api/graphql/workspace-query-runner/utils/parse-result.util';
|
||||
|
||||
describe('handleSpecialKey', () => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
let result;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -13,10 +14,12 @@ describe('handleSpecialKey', () => {
|
||||
|
||||
test('should correctly process a composite key and add it to the result object', () => {
|
||||
handleCompositeKey(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
result,
|
||||
createCompositeFieldKey('complexField', 'link'),
|
||||
'value1',
|
||||
);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
expect(result).toEqual({
|
||||
complexField: {
|
||||
link: 'value1',
|
||||
@@ -26,15 +29,18 @@ describe('handleSpecialKey', () => {
|
||||
|
||||
test('should add values under the same newKey if called multiple times', () => {
|
||||
handleCompositeKey(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
result,
|
||||
createCompositeFieldKey('complexField', 'link'),
|
||||
'value1',
|
||||
);
|
||||
handleCompositeKey(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
result,
|
||||
createCompositeFieldKey('complexField', 'text'),
|
||||
'value2',
|
||||
);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
expect(result).toEqual({
|
||||
complexField: {
|
||||
link: 'value1',
|
||||
@@ -44,7 +50,9 @@ describe('handleSpecialKey', () => {
|
||||
});
|
||||
|
||||
test('should not create a new field if the composite key is not correctly formed', () => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
handleCompositeKey(result, 'COMPOSITE___complexField', 'value1');
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
expect(result).toEqual({});
|
||||
});
|
||||
});
|
||||
|
||||
+2
@@ -35,6 +35,7 @@ const pgGraphQLErrorMapping: PgGraphQLErrorMapping = {
|
||||
'duplicate key value violates unique constraint': (command, objectName, _) =>
|
||||
new WorkspaceQueryRunnerException(
|
||||
`Cannot ${
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
pgGraphQLCommandMapping[command] ?? command
|
||||
} ${objectName} because it violates a uniqueness constraint.`,
|
||||
WorkspaceQueryRunnerExceptionCode.QUERY_VIOLATES_UNIQUE_CONSTRAINT,
|
||||
@@ -42,6 +43,7 @@ const pgGraphQLErrorMapping: PgGraphQLErrorMapping = {
|
||||
'violates foreign key constraint': (command, objectName, _) =>
|
||||
new WorkspaceQueryRunnerException(
|
||||
`Cannot ${
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
pgGraphQLCommandMapping[command] ?? command
|
||||
} ${objectName} because it violates a foreign key constraint.`,
|
||||
WorkspaceQueryRunnerExceptionCode.QUERY_VIOLATES_FOREIGN_KEY_CONSTRAINT,
|
||||
|
||||
Reference in New Issue
Block a user