Skip to content

Commit

Permalink
Fix imports and declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
JCQuintas committed Apr 15, 2024
1 parent 65399df commit cb8d1c4
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 276 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import startOfWeek from 'date-fns/startOfWeek';
import startOfYear from 'date-fns/startOfYear';
import isWithinInterval from 'date-fns/isWithinInterval';
import defaultLocale from 'date-fns/locale/en-US';
// @ts-ignore
import longFormatters from 'date-fns/_lib/format/longFormatters';
import { AdapterDateFnsBase } from '../AdapterDateFnsBase';

Expand Down Expand Up @@ -76,6 +77,7 @@ type DateFnsLocale = typeof defaultLocale;
*/
export class AdapterDateFns
extends AdapterDateFnsBase<DateFnsLocale>
// @ts-ignore we fix date typings in the x-date-picker package.
implements MuiPickersAdapter<Date, DateFnsLocale>
{
constructor({ locale, formats }: AdapterOptions<DateFnsLocale, never> = {}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,6 @@ type DateFnsAdapterBaseOptions<DateFnsLocale extends DateFnsLocaleBase> = MakeRe
longFormatters: Record<'p' | 'P', (token: string, formatLong: any) => string>;
};

declare module '@mui/x-adapter-common/PickersValidDate' {
interface PickerValidDateLookup {
'date-fns': Date;
}
}

/**
* Based on `@date-io/date-fns`
*
Expand Down Expand Up @@ -154,6 +148,7 @@ declare module '@mui/x-adapter-common/PickersValidDate' {
export class AdapterDateFnsBase<DateFnsLocale extends DateFnsLocaleBase>
implements
Pick<
// @ts-ignore we fix date typings in the x-date-picker package.
MuiPickersAdapter<Date, DateFnsLocale>,
| 'date'
| 'getInvalidDate'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable class-methods-use-this */
import { AdapterFormats, AdapterOptions, MuiPickersAdapter } from '@mui/x-adapter-common';

import {
addDays,
dateFnsFormat,
Expand Down Expand Up @@ -76,6 +77,7 @@ import { AdapterDateFnsBase } from '../AdapterDateFnsBase';
*/
export class AdapterDateFns
extends AdapterDateFnsBase<DateFnsLocale>
// @ts-ignore we fix date typings in the x-date-picker package.
implements MuiPickersAdapter<Date, DateFnsLocale>
{
constructor({ locale, formats }: AdapterOptions<DateFnsLocale, never> = {}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,6 @@ type DateFnsAdapterBaseOptions<DateFnsLocale extends DateFnsLocaleBase> = MakeRe
longFormatters: Record<'p' | 'P', (token: string, formatLong: any) => string>;
};

declare module '@mui/x-adapter-common/PickersValidDate' {
interface PickerValidDateLookup {
'date-fns': Date;
}
}

/**
* Based on `@date-io/date-fns`
*
Expand Down Expand Up @@ -154,6 +148,7 @@ declare module '@mui/x-adapter-common/PickersValidDate' {
export class AdapterDateFnsBase<DateFnsLocale extends DateFnsLocaleBase>
implements
Pick<
// @ts-ignore we fix date typings in the x-date-picker package.
MuiPickersAdapter<Date, DateFnsLocale>,
| 'date'
| 'getInvalidDate'
Expand Down
2 changes: 1 addition & 1 deletion packages/x-date-pickers-pro/src/AdapterDateFns/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { AdapterDateFns } from '@mui/x-adapter-date-fns-v2';
export { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
2 changes: 1 addition & 1 deletion packages/x-date-pickers-pro/src/AdapterDateFnsV3/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { AdapterDateFns } from '@mui/x-adapter-date-fns-v3';
export { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
6 changes: 6 additions & 0 deletions packages/x-date-pickers/src/AdapterDateFns/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export { AdapterDateFns } from '@mui/x-adapter-date-fns-v2';

declare module '@mui/x-date-pickers/models' {
interface PickerValidDateLookup {
'date-fns': Date;
}
}
6 changes: 6 additions & 0 deletions packages/x-date-pickers/src/AdapterDateFnsV3/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export { AdapterDateFns } from '@mui/x-adapter-date-fns-v3';

declare module '@mui/x-date-pickers/models' {
interface PickerValidDateLookup {
'date-fns': Date;
}
}

0 comments on commit cb8d1c4

Please sign in to comment.