apply migration with ts-migrate

This commit is contained in:
Thomas Ruoff
2020-08-26 23:17:11 +02:00
committed by Thomas Ruoff
parent be1e22460d
commit c3d8c6f3e0
7 changed files with 16 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ import { WizardContext } from './context/wizardStore'
import Required from './required'
export default function Contact() {
// @ts-expect-error ts-migrate(2339) FIXME: Property 'state' does not exist on type '{}'.
const { state, onChangeEvent } = useContext(WizardContext)
const { name, email, street, zip, city } = state.formData

View File

@@ -6,6 +6,7 @@ import {
clearBookingData,
} from '../../../helpers/storage'
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
export const WizardContext = React.createContext()
export const ACTIONS = {

View File

@@ -11,7 +11,9 @@ import { dateFormatBackend } from '../../helpers/date'
import { getNextSmaller, getNextBigger } from '../../helpers/array'
import MomentLocaleUtils, {
// @ts-expect-error ts-migrate(2614) FIXME: Module '"../../node_modules/react-day-picker/types... Remove this comment to see the full error message
formatDate,
// @ts-expect-error ts-migrate(2614) FIXME: Module '"../../node_modules/react-day-picker/types... Remove this comment to see the full error message
parseDate,
} from 'react-day-picker/moment'
import 'moment/locale/de'
@@ -19,11 +21,13 @@ import 'moment/locale/de'
const fetcher = (path) => fetch(path).then((r) => r.json())
export default function DateSelect() {
// @ts-expect-error ts-migrate(2339) FIXME: Property 'state' does not exist on type '{}'.
const { state, onChange } = useContext(WizardContext)
const [range, setRange] = useState({
form: state.startDate && new Date(state.startDate),
to: state.endDate && new Date(state.endDate),
})
// @ts-expect-error ts-migrate(2339) FIXME: Property 'from' does not exist on type '{ form: Da... Remove this comment to see the full error message
const { from, to } = range
const { data: daysBooked, error: fetchBookedOnError } = useSWR(
'/api/daysbooked',
@@ -53,6 +57,7 @@ export default function DateSelect() {
}
useEffect(() => {
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
toRef.current?.getInput().focus()
}, [from])
@@ -97,6 +102,7 @@ export default function DateSelect() {
modifiers,
numberOfMonths: 1,
}}
// @ts-expect-error ts-migrate(2345) FIXME: Object literal may only specify known properties, ... Remove this comment to see the full error message
onDayChange={(from) => setRange({ ...range, from })}
/>
{' - '}
@@ -120,6 +126,7 @@ export default function DateSelect() {
}}
onDayChange={(to) => setRange({ ...range, to })}
/>
{/* @ts-expect-error ts-migrate(2345) FIXME: Type '{}' provides no match for the signature '(pr... Remove this comment to see the full error message */}
<button onClick={() => setRange({})} className="ibtn">
<svg className="w-full" viewBox="0 0 352 512">
<path

View File

@@ -9,6 +9,7 @@ import Reason from './reason'
import Contact from './contact'
function WizardInternal() {
// @ts-expect-error ts-migrate(2339) FIXME: Property 'onSubmit' does not exist on type '{}'.
const { onSubmit, state, forgetData, storeData } = useContext(WizardContext)
const {
postData,

View File

@@ -3,6 +3,7 @@ import { WizardContext } from './context/wizardStore'
import Required from './required'
export default function Contact() {
// @ts-expect-error ts-migrate(2339) FIXME: Property 'state' does not exist on type '{}'.
const { state, onChangeEvent } = useContext(WizardContext)
const { formDataChanged } = state