Ludo
Ludo

Reputation: 103

react-admin typescript: Cannot use namespace as a type

I'm trying to add somes files from the react-admin example demo, and i have somes errors:

Cannot use namespace 'FilterProps' as a type.

Code example:

https://github.com/marmelab/react-admin/blob/master/examples/demo/src/orders/OrderList.tsx

const OrderFilter: FC<Omit<FilterProps, 'children'>> = (props) => (
  <Filter {...props}>
    <SearchInput source='q' alwaysOn />
    <ReferenceInput source='user_id' reference='users'>
      <AutocompleteInput
        optionText={(choice: Customer) =>
          choice.first_name && choice.last_name
            ? `${choice.first_name} ${choice.last_name}`
            : ''
        }
      />
    </ReferenceInput>
    <DateInput source='date_gte' />
    <DateInput source='date_lte' />
    <TextInput source='total_gte' />
    <NullableBooleanInput source='returned' />
  </Filter>
);

Same error for Identifier and ListProps.

Also, in the import FilterProps, Identifier, ListProps have messages "is declared but its value is never read"

I already used .tsx for customize the layout AppBar, etc. without errors. The code was copied from github without modification.

Where the errors came from?

Thanks & Regards

Upvotes: 1

Views: 2076

Answers (1)

Ludo
Ludo

Reputation: 103

The errors goes with this imports:

import { Identifier } from 'ra-core';
import { ListProps, DatagridProps, FilterProps } from 'ra-ui-materialui';

Upvotes: 1

Related Questions