remix-auth-form icon indicating copy to clipboard operation
remix-auth-form copied to clipboard

The FormStrategy constructor doesn't accept any arguments.

Open Artmann opened this issue 9 months ago • 1 comments

It looks like the constructor is broken in the v1.5.0 version.

Expected 0 arguments, but got 1.ts(2554)

image

The constructor seems to be missing in index..d.ts

import { AppLoadContext, SessionStorage } from "@remix-run/server-runtime";
import { AuthenticateOptions, Strategy } from "remix-auth";
export interface FormStrategyVerifyParams {
    /**
     * A FormData object with the content of the form used to trigger the
     * authentication.
     *
     * Here you can read any input value using the FormData API.
     */
    form: FormData;
    /**
     * An object of arbitrary for route loaders and actions provided by the
     * server's `getLoadContext()` function.
     */
    context?: AppLoadContext;
    /**
     * The request that triggered the authentication.
     */
    request: Request;
}
export declare class FormStrategy<User> extends Strategy<User, FormStrategyVerifyParams> {
    name: string;
    authenticate(request: Request, sessionStorage: SessionStorage, options: AuthenticateOptions): Promise<User>;
    private readFormData;
}

Artmann avatar Apr 28 '24 14:04 Artmann

The constructor is not needed because FormStrategy uses the same one used by Strategy class from Remix Auth, that's why it's not in the type.

The tests of the packages shows TS doesn't complain against the constructor argument, even when importing from the built files instead of the source files.

If you can, try to create a reproduction repo with this TS issue.

sergiodxa avatar Jun 03 '24 05:06 sergiodxa