jefersondaniel / dom-form-serializer

Serialize forms fields into a JSON representation
https://jefersondaniel.com/dom-form-serializer/
MIT License
40 stars 5 forks source link

Include types #11

Open fregante opened 2 years ago

fregante commented 2 years ago

I've been using these types for a while. They're not complete but they might help someone. It'd be great to have them extended and included in the package:

declare module 'dom-form-serializer' {
    import {JsonObject} from 'type-fest';

    export function serialize(
        element: HTMLFormElement,
        options: {
            include?: string[];
        }
    ): JSONValue;

    export function deserialize(
        element: HTMLFormElement,
        serializedData: JsonObject,
        options?: {
            include?: string[];
        }
    ): void;
}
jefersondaniel commented 2 years ago

Thanks, I liked the idea. I was also planning to convert this library to typescript but I don't have free time to do it in the short term.