Skip to content

Commit 4cd160f

Browse files
authored
Fix the type upgrades (codesandbox#3331)
* Fix the type upgrades * Leave styled-components unchanged
1 parent 0d83825 commit 4cd160f

File tree

15 files changed

+53
-44
lines changed

15 files changed

+53
-44
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"lint-staged": "^9.2.5",
9090
"prettier": "1.19.1",
9191
"pretty-quick": "^2.0.1",
92-
"typescript": "3.7.2",
92+
"typescript": "3.7.4",
9393
"username": "^5.1.0"
9494
},
9595
"husky": {

packages/app/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
"@types/lodash-es": "^4.17.2",
254254
"@types/phoenix": "^1.4.0",
255255
"@types/prop-types": "^15.7.0",
256-
"@types/react": "^16.8.12",
256+
"@types/react": "^16.9.17",
257257
"@types/react-color": "^2.17.3",
258258
"@types/react-dom": "^16.8.3",
259259
"@types/react-helmet": "^5.0.11",
@@ -265,7 +265,7 @@
265265
"@types/semver": "6.2.0",
266266
"@types/socket.io-client": "^1.4.32",
267267
"@types/stripe-v3": "^3.1.7",
268-
"@types/styled-components": "^4.1.13",
268+
"@types/styled-components": "^4.4.2",
269269
"acorn-dynamic-import": "^4.0.0",
270270
"babel-jest": "^24.8.0",
271271
"babel-loader": "8.0.2",
@@ -331,7 +331,7 @@
331331
"terser": "^4.1.4",
332332
"terser-webpack-plugin": "^1.4.1",
333333
"thread-loader": "^2.1.2",
334-
"typescript": "3.7.2",
334+
"typescript": "3.7.4",
335335
"url-loader": "1.0.1",
336336
"webpack": "^4.36.1",
337337
"webpack-bundle-analyzer": "^2.13.1",

packages/app/src/app/pages/Dashboard/Sidebar/SandboxesItem/FolderEntry/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,14 @@ class FolderEntry extends React.Component<Props, State> {
219219
});
220220
}
221221

222+
// TODO: fix the typings of this container and make sure it works with `as`
223+
const UnTypedContainer = Container as any;
224+
222225
return connectDropTarget(
223226
connectDragSource(
224227
<div>
225228
<ContextMenu items={menuItems}>
226-
<Container
229+
<UnTypedContainer
227230
as={onSelect ? 'div' : undefined}
228231
onClick={onSelect ? this.handleSelect : undefined}
229232
style={{
@@ -336,7 +339,7 @@ class FolderEntry extends React.Component<Props, State> {
336339
) : (
337340
name
338341
)}
339-
</Container>
342+
</UnTypedContainer>
340343
</ContextMenu>
341344

342345
<ReactShow

packages/app/src/app/pages/Sandbox/Editor/Workspace/Chat/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const Messages = styled.div`
2424

2525
export const Chat: React.FC = () => {
2626
const [value, setValue] = useState('');
27-
const [height, setHeight] = useState('');
27+
const [height, setHeight] = useState<number>(null);
2828
const { state, actions } = useOvermind();
2929
const messagesRef = useRef(null);
3030
const scrollDown = () => {
@@ -34,7 +34,7 @@ export const Chat: React.FC = () => {
3434
};
3535
useEffect(scrollDown);
3636

37-
const handleKeyDown = (e: KeyboardEvent) => {
37+
const handleKeyDown = (e: React.KeyboardEvent) => {
3838
if (e.keyCode === ENTER && !e.shiftKey) {
3939
e.preventDefault();
4040
e.stopPropagation();
@@ -47,7 +47,9 @@ export const Chat: React.FC = () => {
4747
}
4848
};
4949

50-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
50+
const handleChange = (
51+
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
52+
) => {
5153
setValue(e.target.value);
5254
};
5355

@@ -112,17 +114,14 @@ export const Chat: React.FC = () => {
112114
<AutosizeTextArea
113115
useCacheForDOMMeasurements
114116
value={value}
115-
// @ts-ignore
116117
onChange={handleChange}
117118
placeholder="Send a message..."
118119
style={{
119120
width: '100%',
120121
minHeight: height,
121122
marginTop: '0.5rem',
122123
}}
123-
// @ts-ignore
124124
onKeyDown={handleKeyDown}
125-
// @ts-ignore
126125
onHeightChange={setHeight}
127126
/>
128127
</Container>

packages/app/src/app/pages/common/LikeHeart/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Sandbox } from '@codesandbox/common/lib/types';
22
import React, { FunctionComponent, ComponentProps } from 'react';
3+
import { StyledComponentInnerOtherProps } from 'styled-components';
34

45
import { useOvermind } from 'app/overmind';
56

@@ -17,11 +18,10 @@ type Props = {
1718
colorless?: boolean;
1819
sandbox: Sandbox;
1920
text?: number;
21+
className?: string;
22+
style?: React.CSSProperties;
2023
} & Partial<Pick<ComponentProps<typeof MaybeTooltip>, 'disableTooltip'>> &
21-
Pick<
22-
ComponentProps<typeof Container>,
23-
'className' | 'highlightHover' | 'style'
24-
>;
24+
Pick<StyledComponentInnerOtherProps<typeof Container>, 'highlightHover'>;
2525

2626
export const LikeHeart: FunctionComponent<Props> = ({
2727
className,

packages/app/src/app/pages/common/Navigation/Actions/ShowNotificationsAction.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
2-
import React, { FunctionComponent, MouseEvent } from 'react';
2+
import React, { FunctionComponent } from 'react';
33
import BellIcon from 'react-icons/lib/md/notifications';
44

55
import { useOvermind } from 'app/overmind';
66

77
import { Action, UnreadIcon } from '../elements';
88

99
type Props = {
10-
openNotifications: (event: MouseEvent<HTMLDivElement>) => void;
10+
openNotifications: (
11+
event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>
12+
) => void;
1113
};
1214
export const ShowNotificationsAction: FunctionComponent<Props> = ({
1315
openNotifications,

packages/codesandbox-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"tslint-config-prettier": "^1.1.0",
9595
"tslint-config-standard": "^6.0.0",
9696
"typedoc": "^0.7.1",
97-
"typescript": "3.7.2",
97+
"typescript": "3.7.4",
9898
"uuid": "^3.3.2",
9999
"validate-commit-msg": "^2.12.2"
100100
},

packages/common/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"@types/color": "0.12.1",
9494
"@types/humps": "^1.1.2",
9595
"@types/lodash": "^4.14.123",
96-
"@types/react": "^16.8.12",
96+
"@types/react": "^16.9.17",
9797
"@types/react-icons": "^2.2.7",
9898
"@types/storybook__addon-actions": "^3.4.3",
9999
"@types/styled-components": "^4.1.13",
@@ -112,7 +112,7 @@
112112
"jest-styled-components": "^6.3.4",
113113
"jest-svg-transformer": "^1.0.0",
114114
"rimraf": "^2.6.3",
115-
"typescript": "3.7.2",
115+
"typescript": "3.7.4",
116116
"yarn": "^1.17.3"
117117
}
118118
}

packages/executors/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
"@types/socket.io-client": "^1.4.32",
3030
"tsdx": "^0.6.1",
3131
"tslib": "^1.9.3",
32-
"typescript": "3.7.2"
32+
"typescript": "3.7.4"
3333
}
3434
}

packages/node-services/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
"@types/node": "^11.10.5",
2626
"@types/resolve": "^0.0.8",
2727
"@types/ws": "^6.0.1",
28-
"typescript": "3.7.2"
28+
"typescript": "3.7.4"
2929
}
3030
}

0 commit comments

Comments
 (0)