mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 15:07:13 +01:00
apply migration with ts-migrate
This commit is contained in:
committed by
Thomas Ruoff
parent
be1e22460d
commit
c3d8c6f3e0
@@ -3,6 +3,7 @@ import { WizardContext } from './context/wizardStore'
|
|||||||
import Required from './required'
|
import Required from './required'
|
||||||
|
|
||||||
export default function Contact() {
|
export default function Contact() {
|
||||||
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'state' does not exist on type '{}'.
|
||||||
const { state, onChangeEvent } = useContext(WizardContext)
|
const { state, onChangeEvent } = useContext(WizardContext)
|
||||||
|
|
||||||
const { name, email, street, zip, city } = state.formData
|
const { name, email, street, zip, city } = state.formData
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
clearBookingData,
|
clearBookingData,
|
||||||
} from '../../../helpers/storage'
|
} from '../../../helpers/storage'
|
||||||
|
|
||||||
|
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
|
||||||
export const WizardContext = React.createContext()
|
export const WizardContext = React.createContext()
|
||||||
|
|
||||||
export const ACTIONS = {
|
export const ACTIONS = {
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ import { dateFormatBackend } from '../../helpers/date'
|
|||||||
import { getNextSmaller, getNextBigger } from '../../helpers/array'
|
import { getNextSmaller, getNextBigger } from '../../helpers/array'
|
||||||
|
|
||||||
import MomentLocaleUtils, {
|
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,
|
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,
|
parseDate,
|
||||||
} from 'react-day-picker/moment'
|
} from 'react-day-picker/moment'
|
||||||
import 'moment/locale/de'
|
import 'moment/locale/de'
|
||||||
@@ -19,11 +21,13 @@ import 'moment/locale/de'
|
|||||||
const fetcher = (path) => fetch(path).then((r) => r.json())
|
const fetcher = (path) => fetch(path).then((r) => r.json())
|
||||||
|
|
||||||
export default function DateSelect() {
|
export default function DateSelect() {
|
||||||
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'state' does not exist on type '{}'.
|
||||||
const { state, onChange } = useContext(WizardContext)
|
const { state, onChange } = useContext(WizardContext)
|
||||||
const [range, setRange] = useState({
|
const [range, setRange] = useState({
|
||||||
form: state.startDate && new Date(state.startDate),
|
form: state.startDate && new Date(state.startDate),
|
||||||
to: state.endDate && new Date(state.endDate),
|
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 { from, to } = range
|
||||||
const { data: daysBooked, error: fetchBookedOnError } = useSWR(
|
const { data: daysBooked, error: fetchBookedOnError } = useSWR(
|
||||||
'/api/daysbooked',
|
'/api/daysbooked',
|
||||||
@@ -53,6 +57,7 @@ export default function DateSelect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// @ts-expect-error ts-migrate(2532) FIXME: Object is possibly 'undefined'.
|
||||||
toRef.current?.getInput().focus()
|
toRef.current?.getInput().focus()
|
||||||
}, [from])
|
}, [from])
|
||||||
|
|
||||||
@@ -97,6 +102,7 @@ export default function DateSelect() {
|
|||||||
modifiers,
|
modifiers,
|
||||||
numberOfMonths: 1,
|
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 })}
|
onDayChange={(from) => setRange({ ...range, from })}
|
||||||
/>
|
/>
|
||||||
{' - '}
|
{' - '}
|
||||||
@@ -120,6 +126,7 @@ export default function DateSelect() {
|
|||||||
}}
|
}}
|
||||||
onDayChange={(to) => setRange({ ...range, to })}
|
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">
|
<button onClick={() => setRange({})} className="ibtn">
|
||||||
<svg className="w-full" viewBox="0 0 352 512">
|
<svg className="w-full" viewBox="0 0 352 512">
|
||||||
<path
|
<path
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import Reason from './reason'
|
|||||||
import Contact from './contact'
|
import Contact from './contact'
|
||||||
|
|
||||||
function WizardInternal() {
|
function WizardInternal() {
|
||||||
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'onSubmit' does not exist on type '{}'.
|
||||||
const { onSubmit, state, forgetData, storeData } = useContext(WizardContext)
|
const { onSubmit, state, forgetData, storeData } = useContext(WizardContext)
|
||||||
const {
|
const {
|
||||||
postData,
|
postData,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { WizardContext } from './context/wizardStore'
|
|||||||
import Required from './required'
|
import Required from './required'
|
||||||
|
|
||||||
export default function Contact() {
|
export default function Contact() {
|
||||||
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'state' does not exist on type '{}'.
|
||||||
const { state, onChangeEvent } = useContext(WizardContext)
|
const { state, onChangeEvent } = useContext(WizardContext)
|
||||||
|
|
||||||
const { formDataChanged } = state
|
const { formDataChanged } = state
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
import { getNextSmaller, getNextBigger } from './array'
|
import { getNextSmaller, getNextBigger } from './array'
|
||||||
|
|
||||||
|
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'test'. Do you need to install ty... Remove this comment to see the full error message
|
||||||
test('getPreviousInOrder', () => {
|
test('getPreviousInOrder', () => {
|
||||||
const result = getNextSmaller([3, 1, 2, 0, 8, 9, 10], 5)
|
const result = getNextSmaller([3, 1, 2, 0, 8, 9, 10], 5)
|
||||||
|
|
||||||
|
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'expect'.
|
||||||
expect(result).toEqual(3)
|
expect(result).toEqual(3)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'test'. Do you need to install ty... Remove this comment to see the full error message
|
||||||
test('getNextInOrder', () => {
|
test('getNextInOrder', () => {
|
||||||
const result = getNextBigger([7, 8, 9, 3, 1, 2], 4)
|
const result = getNextBigger([7, 8, 9, 3, 1, 2], 4)
|
||||||
|
|
||||||
|
// @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'expect'.
|
||||||
expect(result).toEqual(7)
|
expect(result).toEqual(7)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export function dateFormatFrontend(date) {
|
|||||||
function dateParse(string, format) {
|
function dateParse(string, format) {
|
||||||
const date = moment(string, format)
|
const date = moment(string, format)
|
||||||
if (date.isValid()) {
|
if (date.isValid()) {
|
||||||
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'getDate' does not exist on type 'Moment'... Remove this comment to see the full error message
|
||||||
return date.getDate()
|
return date.getDate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user