Upgrade to TypeScript 5.1
This commit is contained in:
parent
ae75c9ac0d
commit
0b439b79a1
6 changed files with 14 additions and 31 deletions
|
@ -43,6 +43,7 @@ const ListItem: React.FC<IListItem> = ({ label, hint, children, onClick, onSelec
|
||||||
const isSelect = child.type === SelectDropdown || child.type === Select;
|
const isSelect = child.type === SelectDropdown || child.type === Select;
|
||||||
|
|
||||||
return React.cloneElement(child, {
|
return React.cloneElement(child, {
|
||||||
|
// @ts-ignore
|
||||||
id: domId,
|
id: domId,
|
||||||
className: clsx({
|
className: clsx({
|
||||||
'w-auto': isSelect,
|
'w-auto': isSelect,
|
||||||
|
|
|
@ -29,9 +29,12 @@ const FormGroup: React.FC<IFormGroup> = (props) => {
|
||||||
if (React.isValidElement(inputChildren[0])) {
|
if (React.isValidElement(inputChildren[0])) {
|
||||||
firstChild = React.cloneElement(
|
firstChild = React.cloneElement(
|
||||||
inputChildren[0],
|
inputChildren[0],
|
||||||
|
// @ts-ignore
|
||||||
{ id: formFieldId },
|
{ id: formFieldId },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
const isCheckboxFormGroup = firstChild?.type === Checkbox;
|
const isCheckboxFormGroup = firstChild?.type === Checkbox;
|
||||||
|
|
||||||
if (isCheckboxFormGroup) {
|
if (isCheckboxFormGroup) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import React, { useMemo, useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
import { useCreateGroup, useGroupValidation, type CreateGroupParams } from 'soapbox/api/hooks';
|
import { useCreateGroup, useGroupValidation, type CreateGroupParams } from 'soapbox/api/hooks';
|
||||||
import { Modal, Stack } from 'soapbox/components/ui';
|
import { Modal, Stack } from 'soapbox/components/ui';
|
||||||
|
@ -71,9 +72,9 @@ const CreateGroupModal: React.FC<ICreateGroupModal> = ({ onClose }) => {
|
||||||
},
|
},
|
||||||
onError(error) {
|
onError(error) {
|
||||||
if (error instanceof AxiosError) {
|
if (error instanceof AxiosError) {
|
||||||
const msg = error.response?.data.error;
|
const msg = z.object({ error: z.string() }).safeParse(error.response?.data);
|
||||||
if (typeof msg === 'string') {
|
if (msg.success) {
|
||||||
toast.error(msg);
|
toast.error(msg.data.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -33,26 +33,4 @@ export const requestFullscreen = (el: Element): void => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
el.mozRequestFullScreen();
|
el.mozRequestFullScreen();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
type FullscreenListener = (this: Document, ev: Event) => void;
|
|
||||||
|
|
||||||
export const attachFullscreenListener = (listener: FullscreenListener): void => {
|
|
||||||
if ('onfullscreenchange' in document) {
|
|
||||||
document.addEventListener('fullscreenchange', listener);
|
|
||||||
} else if ('onwebkitfullscreenchange' in document) {
|
|
||||||
document.addEventListener('webkitfullscreenchange', listener);
|
|
||||||
} else if ('onmozfullscreenchange' in document) {
|
|
||||||
document.addEventListener('mozfullscreenchange', listener);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const detachFullscreenListener = (listener: FullscreenListener): void => {
|
|
||||||
if ('onfullscreenchange' in document) {
|
|
||||||
document.removeEventListener('fullscreenchange', listener);
|
|
||||||
} else if ('onwebkitfullscreenchange' in document) {
|
|
||||||
document.removeEventListener('webkitfullscreenchange', listener);
|
|
||||||
} else if ('onmozfullscreenchange' in document) {
|
|
||||||
document.removeEventListener('mozfullscreenchange', listener);
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -181,7 +181,7 @@
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1",
|
||||||
"twemoji": "https://github.com/twitter/twemoji#v14.0.2",
|
"twemoji": "https://github.com/twitter/twemoji#v14.0.2",
|
||||||
"typescript": "^4.4.4",
|
"typescript": "^5.1.3",
|
||||||
"util": "^0.12.4",
|
"util": "^0.12.4",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
"webpack": "^5.72.1",
|
"webpack": "^5.72.1",
|
||||||
|
|
|
@ -17150,10 +17150,10 @@ typescript@^4.0:
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324"
|
||||||
integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==
|
integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==
|
||||||
|
|
||||||
typescript@^4.4.4:
|
typescript@^5.1.3:
|
||||||
version "4.5.5"
|
version "5.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.3.tgz#8d84219244a6b40b6fb2b33cc1c062f715b9e826"
|
||||||
integrity sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==
|
integrity sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==
|
||||||
|
|
||||||
typeson-registry@^1.0.0-alpha.20:
|
typeson-registry@^1.0.0-alpha.20:
|
||||||
version "1.0.0-alpha.39"
|
version "1.0.0-alpha.39"
|
||||||
|
|
Loading…
Reference in a new issue