Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Fix return type warnings #25275

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function CustomSoundsRoute(): ReactElement {
small
square
aria-label={t('Play')}
onClick={(e) => {
onClick={(e): void => {
e.preventDefault();
e.stopPropagation();
handlePlay(sound._id);
Expand Down
16 changes: 8 additions & 8 deletions apps/meteor/client/views/admin/mailer/Mailer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TextInput, TextAreaInput, Field, FieldGroup, CheckBox, Button, Icon, ButtonGroup } from '@rocket.chat/fuselage';
import React, { useState, useCallback, SyntheticEvent } from 'react';
import React, { useState, useCallback, SyntheticEvent, ReactElement } from 'react';

import { validateEmail } from '../../../../lib/emailValidator';
import { isJSON } from '../../../../lib/utils/isJSON';
Expand All @@ -11,7 +11,7 @@ type MailerProps = {
sendMail: ({ fromEmail, subject, emailBody, dryRun, query }: sendMailObject) => void;
};

export function Mailer({ sendMail }: MailerProps) {
export function Mailer({ sendMail }: MailerProps): ReactElement {
const t = useTranslation();

const [fromEmail, setFromEmail] = useState<{ value: string; error?: string }>({ value: '' });
Expand All @@ -26,7 +26,7 @@ export function Mailer({ sendMail }: MailerProps) {
<ButtonGroup align='end'>
<Button
primary
onClick={() => {
onClick={(): void => {
sendMail({ fromEmail, dryRun, query, subject, emailBody });
}}
>
Expand All @@ -45,7 +45,7 @@ export function Mailer({ sendMail }: MailerProps) {
placeholder={t('Type_your_email')}
value={fromEmail.value}
error={fromEmail.error}
onChange={(e: SyntheticEvent<HTMLInputElement>) => {
onChange={(e: SyntheticEvent<HTMLInputElement>): void => {
setFromEmail({
value: e.currentTarget.value,
error: !validateEmail(e.currentTarget.value) ? t('Invalid_email') : undefined,
Expand All @@ -56,7 +56,7 @@ export function Mailer({ sendMail }: MailerProps) {
</Field>
<Field>
<Field.Row>
<CheckBox id='dryRun' checked={dryRun} onChange={() => setDryRun(!dryRun)} />
<CheckBox id='dryRun' checked={dryRun} onChange={(): void => setDryRun(!dryRun)} />
<Field.Label htmlFor='dry-run'>{t('Dry_run')}</Field.Label>
</Field.Row>
<Field.Hint>{t('Dry_run_description')}</Field.Hint>
Expand All @@ -68,7 +68,7 @@ export function Mailer({ sendMail }: MailerProps) {
id='query'
value={query.value}
error={query.error}
onChange={(e: SyntheticEvent<HTMLInputElement>) => {
onChange={(e: SyntheticEvent<HTMLInputElement>): void => {
setQuery({
value: e.currentTarget.value,
error: e.currentTarget.value && !isJSON(e.currentTarget.value) ? t('Invalid_JSON') : undefined,
Expand All @@ -84,7 +84,7 @@ export function Mailer({ sendMail }: MailerProps) {
<TextInput
id='subject'
value={subject}
onChange={(e: SyntheticEvent<HTMLInputElement>) => {
onChange={(e: SyntheticEvent<HTMLInputElement>): void => {
setSubject(e.currentTarget.value);
}}
/>
Expand All @@ -97,7 +97,7 @@ export function Mailer({ sendMail }: MailerProps) {
id='emailBody'
rows={10}
value={emailBody}
onChange={(e: SyntheticEvent<HTMLInputElement>) => setEmailBody(e.currentTarget.value)}
onChange={(e: SyntheticEvent<HTMLInputElement>): void => setEmailBody(e.currentTarget.value)}
/>
</Field.Row>
<Field.Hint dangerouslySetInnerHTML={{ __html: t('Mailer_body_tags') }} />
Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/client/views/admin/mailer/MailerRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { ReactElement } from 'react';

import { usePermission } from '../../../contexts/AuthorizationContext';
import { useMethod } from '../../../contexts/ServerContext';
Expand All @@ -22,7 +22,7 @@ const useSendMail: useSendMailType = () => {
const t = useTranslation();
const dispatchToastMessage = useToastMessageDispatch();

return ({ fromEmail, subject, emailBody, dryRun, query }) => {
return ({ fromEmail, subject, emailBody, dryRun, query }): void => {
if (query.error) {
dispatchToastMessage({
type: 'error',
Expand Down Expand Up @@ -53,7 +53,7 @@ const useSendMail: useSendMailType = () => {
};
};

export default function MailerRoute() {
export default function MailerRoute(): ReactElement {
const canAccessMailer = usePermission('access-mailer');
const sendMail = useSendMail();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ const MailExportForm: FC<MailExportFormProps> = ({ onCancel, rid }) => {

$('.messages-box .message', $root).on('click', handler);

return () => {
return (): void => {
$('.messages-box', $root).removeClass('selectable');
$('.messages-box .message', $root).off('click', handler).filter('.selected').removeClass('selected');
};
}, [rid, messageList]);
}, [rid, messageList, selectedMessageStore]);

const { handleToUsers, handleAdditionalEmails, handleSubject } = handlers;

Expand Down