Skip to content

Commit cc34bee

Browse files
committed
[IMP] config: enables type checking for binded functions
Task Description Currently all binded function are type as any. This change aims to for type checking on binded function in TypeScript. Related Task/PR Task-3344661 closes #2547 X-original-commit: ab43c5e Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com> Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
1 parent 9e17ae0 commit cc34bee

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tests/test_helpers/mock_helpers.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ export function mockGetBoundingClientRect(
1010
.mockImplementation(function (this: HTMLDivElement) {
1111
const mockedClass = mockedClasses.find((className) => this.classList.contains(className));
1212
if (mockedClass) {
13-
return populateDOMRect(classesWithMocks[mockedClass](this));
13+
const rect = populateDOMRect(classesWithMocks[mockedClass](this));
14+
return {
15+
height: rect.height || this.clientHeight,
16+
width: rect.width || this.clientWidth,
17+
top: rect.top || 0,
18+
right: rect.right || this.clientWidth,
19+
bottom: rect.bottom || this.clientHeight,
20+
left: rect.left || 0,
21+
x: rect.x || 0,
22+
y: rect.y || 0,
23+
toJSON: () => "",
24+
};
1425
}
1526
return originalGetBoundingClientRect.call(this);
1627
});

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"esModuleInterop": true,
1818
"allowJs": true,
1919
"preserveWatchOutput": true,
20-
"sourceMap": true
20+
"sourceMap": true,
21+
"strictBindCallApply": true
2122
},
2223
"include": ["src"],
2324
"typedocOptions": {

0 commit comments

Comments
 (0)