From 82ba3169fe1563f28bc5c2b57e236411ba57732b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 28 Aug 2020 13:45:11 +0200 Subject: [PATCH] chore(deps): prepare us to typescript 4 --- packages/test-utils/src/testUtils/mockBreakpoint.ts | 4 +++- scripts/check-type-dependencies.js | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/test-utils/src/testUtils/mockBreakpoint.ts b/packages/test-utils/src/testUtils/mockBreakpoint.ts index 598ef654e8..72406c88a5 100644 --- a/packages/test-utils/src/testUtils/mockBreakpoint.ts +++ b/packages/test-utils/src/testUtils/mockBreakpoint.ts @@ -54,6 +54,8 @@ export default function mockBreakpoint(initialBreakpoint: Breakpoint = 'xl') { let currentBreakpoint = initialBreakpoint; const queries = Array(); + const previousMatchMedia: any = (window as any).matchMedia; + (window as any).matchMedia = (query: string): QueryList => { const listeners = new Set(); @@ -85,7 +87,7 @@ export default function mockBreakpoint(initialBreakpoint: Breakpoint = 'xl') { }); }, remove() { - delete window.matchMedia; + (window as any).matchMedia = previousMatchMedia; }, }; } diff --git a/scripts/check-type-dependencies.js b/scripts/check-type-dependencies.js index 6ee4626a21..2e53022937 100755 --- a/scripts/check-type-dependencies.js +++ b/scripts/check-type-dependencies.js @@ -86,8 +86,11 @@ function checkTypes(pkg) { 'utf8', ); const deps = (typeDecl.match(/from '.*'/g) || []) - .map(match => match.replace(/from '(.*)'/, '$1')) - .filter(n => !n.startsWith('.')); + .map(match => match.replace(/^.*from '(.*)'.*$/, '$1')) + .filter( + n => + !(n.startsWith('.') || n === pkg.name || n.startsWith(`${pkg.name}/`)), + ); const errors = []; const typeDeps = [];