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

More TS fixes #5313

Merged
merged 2 commits into from
Sep 28, 2020
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
4 changes: 2 additions & 2 deletions packages/ra-core/src/controller/useCreateController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { CRUD_CREATE } from '../actions';
import { Record } from '../types';

export interface CreateProps {
basePath: string;
basePath?: string;
hasCreate?: boolean;
hasEdit?: boolean;
hasList?: boolean;
Expand Down Expand Up @@ -56,7 +56,7 @@ export interface CreateControllerProps {
setOnFailure: SetOnFailure;
setTransform: SetTransformData;
resource: string;
basePath: string;
basePath?: string;
record?: Partial<Record>;
redirect: RedirectionSideEffect;
version: number;
Expand Down
6 changes: 3 additions & 3 deletions packages/ra-core/src/controller/useEditController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import { useTranslate } from '../i18n';
import { CRUD_GET_ONE, CRUD_UPDATE } from '../actions';

export interface EditProps {
basePath: string;
basePath?: string;
hasCreate?: boolean;
hasEdit?: boolean;
hasShow?: boolean;
hasList?: boolean;
id: Identifier;
id?: Identifier;
resource?: string;
undoable?: boolean;
onSuccess?: OnSuccess;
Expand All @@ -56,7 +56,7 @@ export interface EditControllerProps<RecordType extends Record = Record> {
setOnFailure: SetOnFailure;
setTransform: SetTransformData;
resource: string;
basePath: string;
basePath?: string;
record?: RecordType;
redirect: RedirectionSideEffect;
version: number;
Expand Down
6 changes: 3 additions & 3 deletions packages/ra-core/src/controller/useShowController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import { useNotify, useRedirect, useRefresh } from '../sideEffect';
import { CRUD_GET_ONE } from '../actions';

export interface ShowProps {
basePath: string;
basePath?: string;
hasCreate?: boolean;
hasedit?: boolean;
hasShow?: boolean;
hasList?: boolean;
id: Identifier;
id?: Identifier;
resource?: string;
[key: string]: any;
}
Expand All @@ -24,7 +24,7 @@ export interface ShowControllerProps<RecordType extends Record = Record> {
loaded: boolean;
defaultTitle: string;
resource: string;
basePath: string;
basePath?: string;
record?: RecordType;
version: number;
}
Expand Down
9 changes: 5 additions & 4 deletions packages/ra-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ export type DashboardComponent = ComponentType<WithPermissionsChildrenParams>;

export interface LayoutProps {
appBar?: ComponentType;
children?: ReactNode;
dashboard?: DashboardComponent;
logout?: ReactNode;
menu?: ComponentType<{
Expand All @@ -402,7 +403,7 @@ export interface LayoutProps {
export type LayoutComponent = ComponentType<LayoutProps>;

export interface ResourceComponentInjectedProps {
basePath: string;
basePath?: string;
permissions?: any;
resource?: string;
options?: any;
Expand All @@ -416,7 +417,7 @@ export interface ResourceComponentProps<
Params extends { [K in keyof Params]?: string } = {},
C extends StaticContext = StaticContext,
S = LocationState
> extends RouteComponentProps<Params, C, S>,
> extends Partial<RouteComponentProps<Params, C, S>>,
ResourceComponentInjectedProps {}

// deprecated name, use ResourceComponentProps instead
Expand All @@ -426,9 +427,9 @@ export interface ResourceComponentPropsWithId<
Params extends { id?: string } = {},
C extends StaticContext = StaticContext,
S = LocationState
> extends RouteComponentProps<Params, C, S>,
> extends Partial<RouteComponentProps<Params, C, S>>,
ResourceComponentInjectedProps {
id: string;
id?: string;
}

// deprecated name, use ResourceComponentPropsWithId instead
Expand Down
10 changes: 5 additions & 5 deletions packages/ra-ui-materialui/src/detail/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ const useStyles = makeStyles(
const sanitizeRestProps = ({
hasCreate = null,
hasEdit = null,
history,
loaded,
loading,
location,
match,
history = null,
loaded = null,
loading = null,
location = null,
match = null,
onFailure = null,
onSuccess = null,
options = null,
Expand Down
12 changes: 6 additions & 6 deletions packages/ra-ui-materialui/src/detail/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ const useStyles = makeStyles(
const sanitizeRestProps = ({
hasCreate = null,
hasEdit = null,
history,
id,
loaded,
loading,
location,
match,
history = null,
id = null,
loaded = null,
loading = null,
location = null,
match = null,
onFailure = null,
onSuccess = null,
options = null,
Expand Down
34 changes: 11 additions & 23 deletions packages/ra-ui-materialui/src/detail/Show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,29 +191,17 @@ const useStyles = makeStyles(
);

const sanitizeRestProps = ({
actions,
aside,
title,
children,
className,
id,
data,
loading,
loaded,
resource,
hasCreate,
hasEdit,
hasList,
hasShow,
version,
match,
location,
history,
options,
locale,
permissions,
translate,
hasCreate = null,
hasEdit = null,
history = null,
id = null,
loaded = null,
loading = null,
location = null,
match = null,
options = null,
permissions = null,
...rest
}: any) => rest;
}) => rest;

export default Show;
3 changes: 2 additions & 1 deletion packages/ra-ui-materialui/src/layout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import MenuItemLink, { MenuItemLinkProps } from './MenuItemLink';
import NotFound from './NotFound';
import Notification from './Notification';
import Responsive from './Responsive';
import Sidebar from './Sidebar';
import Sidebar, { SidebarProps } from './Sidebar';
import Title, { TitlePropType } from './Title';
import TitleForRecord from './TitleForRecord';
import TopToolbar from './TopToolbar';
Expand All @@ -42,6 +42,7 @@ export {
Notification,
Responsive,
Sidebar,
SidebarProps,
Title,
TitleForRecord,
TitlePropType,
Expand Down