Skip to content

Commit cf73f77

Browse files
authored
Types (#39)
At some point after updating TypeScript, some Form users started to fail due to typechecks.
1 parent 2efaec8 commit cf73f77

File tree

6 files changed

+45
-15
lines changed

6 files changed

+45
-15
lines changed

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
"@babel/core": "7.9.0",
2222
"@babel/preset-react": "7.9.4",
2323
"@babel/runtime-corejs3": "7.9.2",
24-
"@storybook/addon-actions": "5.3.21",
25-
"@storybook/addon-knobs": "5.3.21",
26-
"@storybook/addon-links": "5.3.21",
27-
"@storybook/addons": "5.3.21",
28-
"@storybook/components": "5.3.21",
29-
"@storybook/core-events": "5.3.21",
30-
"@storybook/preact": "5.3.21",
31-
"@storybook/theming": "5.3.21",
24+
"@storybook/addon-actions": "6.2.5",
25+
"@storybook/addon-knobs": "6.2.5",
26+
"@storybook/addon-links": "6.2.5",
27+
"@storybook/addons": "6.2.5",
28+
"@storybook/components": "6.2.5",
29+
"@storybook/core-events": "6.2.5",
30+
"@storybook/preact": "6.2.5",
31+
"@storybook/theming": "6.2.5",
3232
"@types/react": "16.8.8",
3333
"@types/webpack-env": "1.13.9",
3434
"babel-loader": "8.0.6",
@@ -37,9 +37,9 @@
3737
"typescript": "4.2.3"
3838
},
3939
"peerDependencies": {
40-
"@storybook/addons": "^5.0.0",
41-
"@storybook/components": "^5.0.0",
42-
"@storybook/theming": "^5.0.0",
40+
"@storybook/addons": "^6.0.0",
41+
"@storybook/components": "^6.0.0",
42+
"@storybook/theming": "^6.0.0",
4343
"react": ">=16.8.0"
4444
},
4545
"scripts": {
@@ -54,7 +54,7 @@
5454
"build-storybook": "build-storybook -s public -c test/.storybook"
5555
},
5656
"dependencies": {
57-
"@storybook/client-api": "5.3.21",
57+
"@storybook/client-api": "6.2.5",
5858
"@types/styled-jsx": "2.2.8",
5959
"preact": "10.4.1",
6060
"preact-render-to-string": "5.1.7",

src/register/components/SourceSelect.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ export const SourceSelect: FunctionComponent<{
4040
disabled={options.length === 1 && options[0].href === value}
4141
value={value}
4242
onChange={onChange}
43+
44+
// TODO(alanorozco): TS is complaining without these props
45+
translate={null}
46+
onAuxClick={null}
47+
onAuxClickCapture={null}
4348
>
4449
{options.map(({ href, hostname }) => (
4550
<option key={href} value={href}>

src/register/components/VersionComboInput.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ export const VersionComboInput = ({ onChange, defaultValue, ...rest }) => {
126126
updateValue(e.target.value);
127127
inputRef.current?.focus();
128128
}}
129+
130+
// TODO(alanorozco): TS is complaining without these props
131+
translate={null}
132+
onAuxClick={null}
133+
onAuxClickCapture={null}
129134
>
130135
<option value="">by RTV</option>
131136
<optgroup label="channels">{channels}</optgroup>
@@ -138,6 +143,11 @@ export const VersionComboInput = ({ onChange, defaultValue, ...rest }) => {
138143
onChange={(e) => {
139144
updateValue(e.currentTarget.value);
140145
}}
146+
147+
// TODO(alanorozco): TS is complaining without these props
148+
translate={null}
149+
onAuxClick={null}
150+
onAuxClickCapture={null}
141151
/>
142152
{value.length === 0 && (
143153
<div style={{ marginLeft: 6 }}>

src/register/components/Wrapper.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ export const Wrapper: FunctionComponent<Props> = ({ active, api, channel }) => {
116116
<path d="M92.938 34.265h7.07l-2.38-7.015c-.153-.445-.334-.97-.54-1.574-.21-.603-.414-1.256-.615-1.96-.188.715-.384 1.378-.585 1.988-.202.61-.392 1.136-.57 1.58l-2.38 6.98zm16.632 9.794h-4.656c-.522 0-.95-.122-1.29-.362-.336-.24-.57-.548-.7-.923l-1.528-4.465h-9.844l-1.53 4.465c-.116.328-.348.625-.69.888-.344.264-.765.396-1.263.396h-4.692L93.4 18.44h6.147L109.57 44.06zM130.562 33.736c.22.48.43.975.63 1.48.202-.518.415-1.02.64-1.505.225-.487.456-.96.693-1.416l6.645-12.954c.12-.224.24-.397.365-.52.124-.123.264-.214.417-.273.154-.06.33-.088.524-.088h5.27v25.6h-5.295V29.324c0-.714.035-1.49.106-2.32l-6.858 13.168c-.213.41-.5.72-.862.932-.362.21-.773.316-1.235.316h-.816c-.462 0-.873-.104-1.235-.315-.363-.21-.65-.52-.864-.932l-6.893-13.187c.047.41.083.818.106 1.222.023.405.035.778.035 1.117V44.06h-5.295v-25.6h5.269c.194 0 .37.028.523.087.154.06.293.15.417.274.125.123.246.296.365.52l6.663 13.006c.237.446.464.91.684 1.39M160.99 31.013h3.127c1.563 0 2.688-.37 3.376-1.108.687-.738 1.03-1.77 1.03-3.094 0-.585-.088-1.12-.266-1.6-.178-.48-.448-.893-.808-1.24-.363-.344-.82-.612-1.37-.8-.55-.187-1.206-.28-1.963-.28h-3.127v8.123zm0 4.483v8.562h-6.006V18.442h9.133c1.824 0 3.39.214 4.7.64 1.308.43 2.387 1.018 3.233 1.77.847.75 1.473 1.634 1.875 2.653.403 1.02.604 2.122.604 3.306 0 1.278-.208 2.45-.622 3.518-.416 1.065-1.05 1.98-1.902 2.742-.853.762-1.934 1.357-3.243 1.784-1.308.43-2.857.642-4.646.642h-3.127zM40.674 27.253L27.968 48.196h-2.302l2.276-13.647-7.048.01h-.1c-.633 0-1.148-.51-1.148-1.137 0-.27.254-.727.254-.727l12.664-20.92 2.34.01-2.332 13.668 7.084-.008.112-.002c.635 0 1.15.51 1.15 1.14 0 .254-.1.478-.245.668zM30.288 0C13.56 0 0 13.432 0 30 0 46.57 13.56 60 30.288 60c16.73 0 30.29-13.431 30.29-30 0-16.568-13.56-30-30.29-30z" />
117117
</g>
118118
</svg>
119-
<Form>
119+
<Form
120+
// TODO(alanorozco): TS is complaining without these props
121+
translate={null}
122+
onAuxClick={null}
123+
onAuxClickCapture={null}
124+
>
120125
<HorizontalFormFields>
121126
<Form.Field key={"source"} label={"Source"}>
122127
<SourceSelect
@@ -150,6 +155,11 @@ export const Wrapper: FunctionComponent<Props> = ({ active, api, channel }) => {
150155
updateConfig({ ...config, binary: e.target.value });
151156
}}
152157
size="flex"
158+
159+
// TODO(alanorozco): TS is complaining without these props
160+
translate={null}
161+
onAuxClick={null}
162+
onAuxClickCapture={null}
153163
>
154164
<option key={"no-modules"} value={"no-modules"}>
155165
{"v0.js (nomodule)"}
@@ -167,6 +177,11 @@ export const Wrapper: FunctionComponent<Props> = ({ active, api, channel }) => {
167177
updateConfig({ ...config, mode: e.target.value });
168178
}}
169179
size="flex"
180+
181+
// TODO(alanorozco): TS is complaining without these props
182+
translate={null}
183+
onAuxClick={null}
184+
onAuxClickCapture={null}
170185
>
171186
<option key={"ampdoc"} value={"ampdoc"}>
172187
{"AMP"}

src/register/components/bento.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function useBentoMode(
6666
parent.appendChild(iframe);
6767
}
6868

69-
const readyPromise = new Promise((resolve) => {
69+
const readyPromise = new Promise<void>((resolve) => {
7070
const isReady = () => {
7171
const iframeDoc = iframe!.contentDocument;
7272
return (

src/register/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Wrapper } from "./components/Wrapper";
2525
addons.register(AddonName, (api) => {
2626
addons.addPanel(PanelName, {
2727
title: "AMP",
28-
render({ active, key }) {
28+
render({ active = false, key }) {
2929
return (
3030
<Wrapper
3131
key={key}

0 commit comments

Comments
 (0)