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

[Doc] Update exporter usage #5771

Closed
wants to merge 1 commit into from
Closed

Commits on Jan 14, 2021

  1. [Doc] Update exporter usage

    According to the type definition, `Exporter` is a function that returns `Promise<void>`.
    
    ```ts
    # https://github.com/marmelab/react-admin/blob/9cc5e83252455b5e3e172306419431716f17a057/packages/ra-core/src/types.ts#L492-L501
    export type Exporter = (
        data: any,
        fetchRelatedRecords: (
            data: any,
            field: string,
            resource: string
        ) => Promise<any>,
        dataProvider: DataProvider,
        resource?: string
    ) => Promise<void>;
    ```
    
    And `jsonexport` that used in the example is a function that returns `void`.
    So the example's return value does not match `Exporter` type without wrapping with `Promise`.
    
    ```ts
    # https://github.com/DefinitelyTyped/DefinitelyTyped/blob/40e88087e9ec5898250644da6e4653888905bd85/types/jsonexport/index.d.ts#L112-L116
    declare function jsonexport(
        json: object | object[],
        userOptions: jsonexport.UserOptionsWithHandlers,
        cb: (err: Error, csv: string) => void,
    ): void;
    ```
    ohbarye committed Jan 14, 2021
    Configuration menu
    Copy the full SHA
    5839a09 View commit details
    Browse the repository at this point in the history