yocontra / react-responsive

CSS media queries in react - for responsive design, and more.
https://contra.io/react-responsive
MIT License
7.04k stars 298 forks source link

TypeScript errors #297

Closed r3sdev closed 2 years ago

r3sdev commented 2 years ago

Hi,

We're using this package in one of our projects and are running into the following issue:

build   24-May-2022 03:39:55    > tsc --declaration --emitDeclarationOnly --outDir types/ --project src/js/tsconfig.json
build   24-May-2022 03:39:55    
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(3,17): error TS2304: Cannot find name 'ReactNode'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(4,16): error TS2304: Cannot find name 'ReactNode'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(14,16): error TS2528: A module cannot have multiple default exports.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(14,16): error TS2528: A module cannot have multiple default exports.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(14,16): error TS2528: A module cannot have multiple default exports.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(14,16): error TS2528: A module cannot have multiple default exports.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(14,16): error TS2528: A module cannot have multiple default exports.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(16,22): error TS2323: Cannot redeclare exported variable 'Context'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(17,16): error TS2528: A module cannot have multiple default exports.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(19,24): error TS2528: A module cannot have multiple default exports.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(19,33): error TS2323: Cannot redeclare exported variable 'useMediaQuery'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(19,33): error TS2484: Export declaration conflicts with exported declaration of 'useMediaQuery'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(19,48): error TS2323: Cannot redeclare exported variable 'toQuery'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(19,48): error TS2484: Export declaration conflicts with exported declaration of 'toQuery'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(19,57): error TS2323: Cannot redeclare exported variable 'Context'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(19,57): error TS2484: Export declaration conflicts with exported declaration of 'Context'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(20,98): error TS2307: Cannot find module './types' or its corresponding type declarations.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(24,22): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(25,15): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(26,22): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(27,28): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(28,17): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(29,23): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(30,16): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(31,22): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(32,16): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(33,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(34,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(35,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(36,25): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(37,25): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(38,31): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(39,31): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(40,20): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(41,20): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(42,26): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(43,26): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(44,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(45,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(46,25): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(47,25): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(48,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(49,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(50,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(51,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(52,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(53,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(54,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(55,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(56,14): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(57,15): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(58,16): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(59,18): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(60,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(61,16): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(62,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(63,17): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(64,14): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(65,13): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(66,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(69,14): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(70,15): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(71,16): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(72,18): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(73,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(74,16): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(75,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(76,17): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(77,14): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(78,13): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(79,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(82,22): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(83,15): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(84,22): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(85,28): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(86,17): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(87,23): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(88,16): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(89,22): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(90,16): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(91,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(92,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(93,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(97,22): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(98,15): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(99,22): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(100,28): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(101,17): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(102,23): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(103,16): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(104,22): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(105,16): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(106,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(107,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(108,21): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(109,25): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(110,25): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(111,31): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(112,31): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(113,20): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(114,20): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(115,26): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(116,26): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(117,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(118,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(119,25): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(120,25): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(121,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(122,19): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(123,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(124,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(125,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(126,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(127,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(128,24): error TS2503: Cannot find namespace 'PropTypes'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(131,16): error TS2528: A module cannot have multiple default exports.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(133,22): error TS2323: Cannot redeclare exported variable 'toQuery'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(134,16): error TS2528: A module cannot have multiple default exports.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(193,22): error TS2323: Cannot redeclare exported variable 'useMediaQuery'.
build   24-May-2022 03:40:14    node_modules/react-responsive/dist/index.d.ts(194,16): error TS2528: A module cannot have multiple default exports.

Of course we would be able to fix this by adding skipLibCheck: true in tsconfig.json, but we'd rather not and prefer this to be fixed upstream.

yocontra commented 2 years ago

@r3sdev Are you on the latest 9.0.0 beta?

yocontra commented 2 years ago

Just checked the typings files and they do appear messed up - no idea why it generated like that, will fix now.

yocontra commented 2 years ago

Just looked into it and there was some weird webpack shit going on with the type generation, so I yanked it all out and use tsc to generate the types now - can you try 9.0.0-beta10 that was just published and let me know if this resolves it for you?