Skip to content

Commit 75b48b8

Browse files
committed
Implement devicePixelContentBoxSize with TS 4.6+ types
1 parent 2f67b05 commit 75b48b8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/useBreakpoints.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export type UseBreakpointsResult = [any, any] & Matches;
2828
const boxOptions = {
2929
BORDER_BOX: 'border-box', // https://caniuse.com/mdn-api_resizeobserverentry_borderboxsize
3030
CONTENT_BOX: 'content-box', // https://caniuse.com/mdn-api_resizeobserverentry_contentboxsize
31-
DEVICE_PIXEL_CONTENT_BOX: 'device-pixel-content-box' // https://github.com/w3c/csswg-drafts/pull/4476
31+
DEVICE_PIXEL_CONTENT_BOX: 'device-pixel-content-box' // https://caniuse.com/mdn-api_resizeobserverentry_devicepixelcontentboxsize
3232
};
3333

3434
/**
@@ -106,11 +106,7 @@ export const useBreakpoints = (
106106
break;
107107

108108
case boxOptions.DEVICE_PIXEL_CONTENT_BOX:
109-
if (typeof resizeObserverEntry.devicePixelContentBoxSize !== 'undefined') {
110-
observedBoxSize = resizeObserverEntry.devicePixelContentBoxSize[fragment];
111-
} else {
112-
throw Error('resizeObserverEntry does not contain devicePixelContentBoxSize.');
113-
}
109+
observedBoxSize = resizeObserverEntry.devicePixelContentBoxSize[fragment];
114110
break;
115111

116112
default:

0 commit comments

Comments
 (0)