Skip to content

TypeScript declarations don't match runtime exports for Turnstile #46

Description

@AshmitSherigar

Describe the bug

The package exports a named Turnstile component at runtime, but the published TypeScript declarations do not declare that export.

Runtime (dist/index.js)

exports.useTurnstile = exports.Turnstile = void 0;

This allows:

import { Turnstile } from "react-turnstile";

to work at runtime.

Type declarations (dist/index.d.ts)

export declare function TurnstileTurnstile(...): JSX.Element;
export default Turnstile;
export declare function useTurnstile(): TurnstileObject;

There is no declaration for the named export Turnstile, so TypeScript reports:

Module '"react-turnstile"' has no exported member 'Turnstile'. Did you mean 'useTurnstile'?

Expected behavior

The TypeScript declarations should match the runtime exports so the named import works without TypeScript errors.

Additional context

I'm happy to work on a fix if this is considered a bug.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions