Upgrade @types (#9261)

* Upgrade @types

* Make typescript happier
This commit is contained in:
Michael Telatynski 2022-09-12 11:58:05 +01:00 committed by GitHub
parent a9f04514fb
commit 0ab476b828
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 36 deletions

View file

@ -153,13 +153,13 @@
"@types/katex": "^0.14.0",
"@types/lodash": "^4.14.168",
"@types/modernizr": "^3.5.3",
"@types/node": "^14.14.22",
"@types/node": "^14.18.28",
"@types/pako": "^1.0.1",
"@types/parse5": "^6.0.0",
"@types/qrcode": "^1.3.5",
"@types/react": "17.0.14",
"@types/react": "^17.0.49",
"@types/react-beautiful-dnd": "^13.0.0",
"@types/react-dom": "17.0.9",
"@types/react-dom": "^17.0.17",
"@types/react-test-renderer": "^17.0.1",
"@types/react-transition-group": "^4.4.0",
"@types/sanitize-html": "^2.3.1",
@ -205,12 +205,9 @@
"stylelint": "^14.9.1",
"stylelint-config-standard": "^26.0.0",
"stylelint-scss": "^4.2.0",
"typescript": "^4.7.4",
"typescript": "4.7.4",
"walk": "^2.3.14"
},
"resolutions": {
"@types/react": "17.0.14"
},
"jest": {
"snapshotSerializers": [
"enzyme-to-json/serializer"

View file

@ -18,7 +18,7 @@ limitations under the License.
*/
import url from 'url';
import React, { ContextType, createRef, MutableRefObject } from 'react';
import React, { ContextType, createRef, MutableRefObject, ReactNode } from 'react';
import classNames from 'classnames';
import { MatrixCapabilities } from "matrix-widget-api";
import { Room, RoomEvent } from "matrix-js-sdk/src/models/room";
@ -666,7 +666,7 @@ export default class AppTile extends React.Component<IProps, IState> {
);
}
const layoutButtons: React.ReactNodeArray = [];
const layoutButtons: ReactNode[] = [];
if (this.props.showLayoutButtons) {
const isMaximised = WidgetLayoutStore.instance.
isInContainer(this.props.room, this.props.app, Container.Center);

View file

@ -300,7 +300,7 @@ export default class Dropdown extends React.Component<DropdownProps, IState> {
}
private getMenuOptions() {
const options = React.Children.map(this.props.children, (child) => {
const options = React.Children.map(this.props.children, (child: ReactElement) => {
const highlighted = this.state.highlightedOption === child.key;
return (
<MenuOption

View file

@ -38,8 +38,6 @@ export interface IValidateOpts {
interface IProps {
// The field's ID, which binds the input and label together. Immutable.
id?: string;
// The field's type (when used as an <input>). Defaults to "text".
type?: string;
// id of a <datalist> element for suggestions
list?: string;
// The field's label string.

View file

@ -81,7 +81,7 @@ export default class ReplyChain extends React.Component<IProps, IState> {
private unmounted = false;
private room: Room;
private blockquoteRef = React.createRef<HTMLElement>();
private blockquoteRef = React.createRef<HTMLQuoteElement>();
constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
super(props, context);

View file

@ -15,24 +15,22 @@ limitations under the License.
*/
import { Room } from "matrix-js-sdk/src/matrix";
import React, { ComponentPropsWithoutRef, ElementType } from "react";
import React, { HTMLAttributes, ReactHTML } from "react";
import { roomContextDetails } from "../../../utils/i18n-helpers";
type Props<T extends ElementType> = ComponentPropsWithoutRef<T> & {
type Props<T extends keyof ReactHTML> = HTMLAttributes<T> & {
component?: T;
room: Room;
};
export function RoomContextDetails<T extends ElementType>({ room, component: Component = "div", ...other }: Props<T>) {
export function RoomContextDetails<T extends keyof ReactHTML>({ room, component, ...other }: Props<T>) {
const contextDetails = roomContextDetails(room);
if (contextDetails) {
return <Component
{...other}
aria-label={contextDetails.ariaLabel}
>
{ contextDetails.details }
</Component>;
return React.createElement(component ?? "div", {
...other,
"aria-label": contextDetails.ariaLabel,
}, [contextDetails.details]);
}
return null;

View file

@ -2133,11 +2133,16 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.11.tgz#486e72cfccde88da24e1f23ff1b7d8bfb64e6250"
integrity sha512-KZhFpSLlmK/sdocfSAjqPETTMd0ug6HIMIAwkwUpU79olnZdQtMxpQP+G1wDzCH7na+FltSIhbaZuKdwZ8RDrw==
"@types/node@^14.14.22", "@types/node@^14.14.31":
"@types/node@^14.14.31":
version "14.18.26"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.26.tgz#239e19f8b4ea1a9eb710528061c1d733dc561996"
integrity sha512-0b+utRBSYj8L7XAp0d+DX7lI4cSmowNaaTkk6/1SKzbKkG+doLuPusB9EOvzLJ8ahJSk03bTLIL6cWaEd4dBKA==
"@types/node@^14.18.28":
version "14.18.28"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.28.tgz#ddb82da2fff476a8e827e8773c84c19d9c235278"
integrity sha512-CK2fnrQlIgKlCV3N2kM+Gznb5USlwA1KFX3rJVHmgVk6NJxFPuQ86pAcvKnu37IA4BGlSRz7sEE1lHL1aLZ/eQ==
"@types/normalize-package-data@^2.4.0":
version "2.4.1"
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301"
@ -2182,14 +2187,7 @@
dependencies:
"@types/react" "*"
"@types/react-dom@17.0.9":
version "17.0.9"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.9.tgz#441a981da9d7be117042e1a6fd3dac4b30f55add"
integrity sha512-wIvGxLfgpVDSAMH5utdL9Ngm5Owu0VsGmldro3ORLXV8CShrL8awVj06NuEXFQ5xyaYfdca7Sgbk/50Ri1GdPg==
dependencies:
"@types/react" "*"
"@types/react-dom@<18.0.0":
"@types/react-dom@<18.0.0", "@types/react-dom@^17.0.17":
version "17.0.17"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.17.tgz#2e3743277a793a96a99f1bf87614598289da68a1"
integrity sha512-VjnqEmqGnasQKV0CWLevqMTXBYG9GbwuE6x3VetERLh0cq2LTptFE73MrQi2S7GkKXCf2GgwItB/melLnxfnsg==
@ -2220,10 +2218,10 @@
dependencies:
"@types/react" "*"
"@types/react@*", "@types/react@17.0.14", "@types/react@^17":
version "17.0.14"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.14.tgz#f0629761ca02945c4e8fea99b8177f4c5c61fb0f"
integrity sha512-0WwKHUbWuQWOce61UexYuWTGuGY/8JvtUe/dtQ6lR4sZ3UiylHotJeWpf3ArP9+DSGUoLY3wbU59VyMrJps5VQ==
"@types/react@*", "@types/react@17.0.49", "@types/react@^17", "@types/react@^17.0.49":
version "17.0.49"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.49.tgz#df87ba4ca8b7942209c3dc655846724539dc1049"
integrity sha512-CCBPMZaPhcKkYUTqFs/hOWqKjPxhTEmnZWjlHHgIMop67DsXywf9B5Os9Hz8KSacjNOgIdnZVJamwl232uxoPg==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
@ -9033,7 +9031,7 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"
typescript@^4.7.4:
typescript@4.7.4:
version "4.7.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==