mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
ref(TS) Improve TS (#13167)
Fix some errors. Remove @ts-ignores Convert some files to TS Remove some eslint-disables
This commit is contained in:
@@ -10,7 +10,6 @@ import Button from '../../../base/ui/components/web/Button';
|
||||
import Input from '../../../base/ui/components/web/Input';
|
||||
import { areSmileysDisabled } from '../../functions';
|
||||
|
||||
// @ts-ignore
|
||||
import SmileysPanel from './SmileysPanel';
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,6 @@ import { updateSettings } from '../../../base/settings/actions';
|
||||
import Button from '../../../base/ui/components/web/Button';
|
||||
import Input from '../../../base/ui/components/web/Input';
|
||||
|
||||
// @ts-ignore
|
||||
import KeyboardAvoider from './KeyboardAvoider';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// @flow
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { isIosMobileBrowser } from '../../../base/environment/utils';
|
||||
@@ -1,5 +1,3 @@
|
||||
// @flow
|
||||
|
||||
import React, { PureComponent } from 'react';
|
||||
import Emoji from 'react-emoji-render';
|
||||
|
||||
@@ -8,28 +6,28 @@ import { smileys } from '../../smileys';
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link SmileysPanel}.
|
||||
*/
|
||||
type Props = {
|
||||
interface IProps {
|
||||
|
||||
/**
|
||||
* Callback to invoke when a smiley is selected. The smiley will be passed
|
||||
* back.
|
||||
*/
|
||||
onSmileySelect: Function
|
||||
};
|
||||
onSmileySelect: Function;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements a React Component showing smileys that can be be shown in chat.
|
||||
*
|
||||
* @augments Component
|
||||
*/
|
||||
class SmileysPanel extends PureComponent<Props> {
|
||||
class SmileysPanel extends PureComponent<IProps> {
|
||||
/**
|
||||
* Initializes a new {@code SmileysPanel} instance.
|
||||
*
|
||||
* @param {*} props - The read-only properties with which the new instance
|
||||
* is to be initialized.
|
||||
*/
|
||||
constructor(props: Props) {
|
||||
constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
// Bind event handler so it is only bound once for every instance.
|
||||
@@ -38,8 +36,6 @@ class SmileysPanel extends PureComponent<Props> {
|
||||
this._onEscKey = this._onEscKey.bind(this);
|
||||
}
|
||||
|
||||
_onEscKey: (Object) => void;
|
||||
|
||||
/**
|
||||
* KeyPress handler for accessibility.
|
||||
*
|
||||
@@ -47,7 +43,7 @@ class SmileysPanel extends PureComponent<Props> {
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
_onEscKey(e) {
|
||||
_onEscKey(e: React.KeyboardEvent) {
|
||||
// Escape handling does not work in onKeyPress
|
||||
if (e.key === 'Escape') {
|
||||
e.preventDefault();
|
||||
@@ -56,8 +52,6 @@ class SmileysPanel extends PureComponent<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
_onKeyPress: (Object) => void;
|
||||
|
||||
/**
|
||||
* KeyPress handler for accessibility.
|
||||
*
|
||||
@@ -65,15 +59,13 @@ class SmileysPanel extends PureComponent<Props> {
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
_onKeyPress(e) {
|
||||
_onKeyPress(e: React.KeyboardEvent<HTMLDivElement>) {
|
||||
if (e.key === ' ') {
|
||||
e.preventDefault();
|
||||
e.preventDefault(); // @ts-ignore
|
||||
this.props.onSmileySelect(e.target.id && smileys[e.target.id]);
|
||||
}
|
||||
}
|
||||
|
||||
_onClick: (Object) => void;
|
||||
|
||||
/**
|
||||
* Click handler for to select emoji.
|
||||
*
|
||||
@@ -81,9 +73,9 @@ class SmileysPanel extends PureComponent<Props> {
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
_onClick(e) {
|
||||
_onClick(e: React.MouseEvent) {
|
||||
e.preventDefault();
|
||||
this.props.onSmileySelect(e.currentTarget.id && smileys[e.currentTarget.id]);
|
||||
this.props.onSmileySelect(e.currentTarget.id && smileys[e.currentTarget.id as keyof typeof smileys]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +97,7 @@ class SmileysPanel extends PureComponent<Props> {
|
||||
tabIndex = { 0 }>
|
||||
<Emoji
|
||||
onlyEmojiClassName = 'smiley'
|
||||
text = { smileys[smileyKey] } />
|
||||
text = { smileys[smileyKey as keyof typeof smileys] } />
|
||||
</div>
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user