Documentation
    Preparing search index...

    Type Alias FormDataInput<T>

    FormDataInput: T extends any[]
        ? never
        : T extends Function ? never : { [P in keyof T]: Value<T[P]> }

    FormData input type.

    FormDataInput<T> is a type for the input of the FormData request, casting File property value type as an union of File and FormDataInput.IFileProps, especially for the React Native environment.

    You know what? In the React Native environment, File class is not supported. Therefore, when composing a FormData request, you have to put the URI address of the local filesystem with file name and content type that is represented by the FormDataInput.IFileProps type.

    This FormDataInput<T> type is designed for that purpose. If the property value type is a File class, it converts it to an union type of File and FormDataInput.IFileProps type. Also, if the property value type is an array of File class, it converts it to an array of union type of File and FormDataInput.IFileProps type too.

    Atomic fields retain their original types; file fields accept either a File or the React Native file descriptor.

    Type Parameters

    • T extends object

      Target object type.

    Jeongho Nam - https://github.com/samchon

    contracts/common.md#principled-implementation The mapped type delegates each field to a distributive value conversion, so file alternatives and file-array alternatives accept React Native descriptors even when optional or mixed with another field type. Arrays and functions at the outer body level become never because a form body is an object of named fields.

    contracts/common.md#clear-and-simple-design One conditional over the object type, delegating the per-value rule to FormDataInput.Value.

    contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.

    contracts/common.md#meaningful-documentation The comment explains the React Native motive, which fields are converted, and the platform limit of descriptors.