From 6e0981d1df77e19ef8d697c72384b785c1d33204 Mon Sep 17 00:00:00 2001 From: Tom Xu Date: Fri, 23 Oct 2020 10:57:13 +0800 Subject: [PATCH] refactor(responsive-observe): improve typescript type (#27305) --- components/_util/responsiveObserve.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/_util/responsiveObserve.ts b/components/_util/responsiveObserve.ts index d2da1decd0..65d535699e 100644 --- a/components/_util/responsiveObserve.ts +++ b/components/_util/responsiveObserve.ts @@ -1,5 +1,5 @@ export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs'; -export type BreakpointMap = Partial>; +export type BreakpointMap = Record; export type ScreenMap = Partial>; export type ScreenSizeMap = Partial>; @@ -44,7 +44,7 @@ const responsiveObserve = { }, unregister() { Object.keys(responsiveMap).forEach((screen: Breakpoint) => { - const matchMediaQuery = responsiveMap[screen]!; + const matchMediaQuery = responsiveMap[screen]; const handler = this.matchHandlers[matchMediaQuery]; handler?.mql.removeListener(handler?.listener); }); @@ -52,7 +52,7 @@ const responsiveObserve = { }, register() { Object.keys(responsiveMap).forEach((screen: Breakpoint) => { - const matchMediaQuery = responsiveMap[screen]!; + const matchMediaQuery = responsiveMap[screen]; const listener = ({ matches }: { matches: boolean }) => { this.dispatch({ ...screens,