Skip to content

Commit

Permalink
Remove ts-expect-error after merging main
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejkustra committed Jan 25, 2024
1 parent 8181d2b commit 2f91117
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,8 @@ type OnyxValues = {
[ONYXKEYS.FORMS.SETTINGS_STATUS_CLEAR_DATE_FORM_DRAFT]: OnyxTypes.Form;
[ONYXKEYS.FORMS.SETTINGS_STATUS_SET_CLEAR_AFTER_FORM]: OnyxTypes.Form;
[ONYXKEYS.FORMS.SETTINGS_STATUS_SET_CLEAR_AFTER_FORM_DRAFT]: OnyxTypes.Form;
[ONYXKEYS.FORMS.PRIVATE_NOTES_FORM]: OnyxTypes.Form;
[ONYXKEYS.FORMS.PRIVATE_NOTES_FORM_DRAFT]: OnyxTypes.Form;
[ONYXKEYS.FORMS.PRIVATE_NOTES_FORM]: OnyxTypes.PrivateNotesForm;
[ONYXKEYS.FORMS.PRIVATE_NOTES_FORM_DRAFT]: OnyxTypes.PrivateNotesForm;
[ONYXKEYS.FORMS.I_KNOW_A_TEACHER_FORM]: OnyxTypes.IKnowATeacherForm;
[ONYXKEYS.FORMS.I_KNOW_A_TEACHER_FORM_DRAFT]: OnyxTypes.IKnowATeacherForm;
[ONYXKEYS.FORMS.INTRO_SCHOOL_PRINCIPAL_FORM]: OnyxTypes.IntroSchoolPrincipalForm;
Expand Down
8 changes: 3 additions & 5 deletions src/pages/PrivateNotes/PrivateNotesEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import Str from 'expensify-common/lib/str';
import lodashDebounce from 'lodash/debounce';
import React, {useCallback, useMemo, useRef, useState} from 'react';
import {Keyboard} from 'react-native';
import type {TextInput as TextInputRN} from 'react-native';
import type {OnyxCollection} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import FormProvider from '@components/Form/FormProvider';
import InputWrapper from '@components/Form/InputWrapper';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import type {AnimatedTextInputRef} from '@components/RNTextInput';
import ScreenWrapper from '@components/ScreenWrapper';
import Text from '@components/Text';
import TextInput from '@components/TextInput';
Expand Down Expand Up @@ -64,7 +64,7 @@ function PrivateNotesEditPage({route, personalDetailsList, report}: PrivateNotes
);

// To focus on the input field when the page loads
const privateNotesInput = useRef<HTMLInputElement | TextInputRN | null>(null);
const privateNotesInput = useRef<AnimatedTextInputRef | null>(null);
const focusTimeoutRef = useRef<NodeJS.Timeout | null>(null);

useFocusEffect(
Expand Down Expand Up @@ -114,7 +114,6 @@ function PrivateNotesEditPage({route, personalDetailsList, report}: PrivateNotes
shouldShowBackButton
onCloseButtonPress={() => Navigation.dismissModal()}
/>
{/* @ts-expect-error TODO: Remove this once FormProvider (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript. */}
<FormProvider
formID={ONYXKEYS.FORMS.PRIVATE_NOTES_FORM}
onSubmit={savePrivateNote}
Expand All @@ -137,7 +136,6 @@ function PrivateNotesEditPage({route, personalDetailsList, report}: PrivateNotes
style={[styles.mb3]}
>
<InputWrapper
// @ts-expect-error TODO: Remove this once InputWrapper (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript.
InputComponent={TextInput}
role={CONST.ROLE.PRESENTATION}
inputID="privateNotes"
Expand All @@ -154,7 +152,7 @@ function PrivateNotesEditPage({route, personalDetailsList, report}: PrivateNotes
debouncedSavePrivateNote(text);
setPrivateNote(text);
}}
ref={(el) => {
ref={(el: AnimatedTextInputRef) => {
if (!el) {
return;
}
Expand Down
6 changes: 5 additions & 1 deletion src/types/onyx/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ type IntroSchoolPrincipalForm = Form<{
partnerUserID: string;
}>;

type PrivateNotesForm = Form<{
privateNotes: string;
}>;

export default Form;

export type {AddDebitCardForm, DateOfBirthForm, DisplayNameForm, FormValueType, NewRoomForm, BaseForm, IKnowATeacherForm, IntroSchoolPrincipalForm};
export type {AddDebitCardForm, DateOfBirthForm, PrivateNotesForm, DisplayNameForm, FormValueType, NewRoomForm, BaseForm, IKnowATeacherForm, IntroSchoolPrincipalForm};
3 changes: 2 additions & 1 deletion src/types/onyx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type Credentials from './Credentials';
import type Currency from './Currency';
import type CustomStatusDraft from './CustomStatusDraft';
import type Download from './Download';
import type {AddDebitCardForm, DateOfBirthForm, DisplayNameForm, IKnowATeacherForm, IntroSchoolPrincipalForm, NewRoomForm} from './Form';
import type {AddDebitCardForm, DateOfBirthForm, DisplayNameForm, IKnowATeacherForm, IntroSchoolPrincipalForm, NewRoomForm, PrivateNotesForm} from './Form';
import type Form from './Form';
import type FrequentlyUsedEmoji from './FrequentlyUsedEmoji';
import type {FundList} from './Fund';
Expand Down Expand Up @@ -150,4 +150,5 @@ export type {
NewRoomForm,
IKnowATeacherForm,
IntroSchoolPrincipalForm,
PrivateNotesForm,
};

0 comments on commit 2f91117

Please sign in to comment.