Skip to content

Fix JSDoc on onSuccess: 'public_key' should be 'public_token' (src/types/index.ts:93) #397

Description

@Nexory

Summary

The JSDoc comment on the onSuccess callback inside CommonPlaidLinkOptions (src/types/index.ts:93) refers to the first argument as public_key. Since the library migrated to Link Token authentication, the SDK delivers a public_token — the value the host application must POST to /link/token/exchange to obtain an access token. The stale term public_key was part of the older public-key flow and is now incorrect and potentially misleading.

What I observed

src/types/index.ts, lines 91–93:

export interface CommonPlaidLinkOptions<T> {
  // A function that is called when a user has successfully connecter an Item.
  // The function should expect two arguments, the public_key and a metadata object
  onSuccess: T;

The comment says public_key; the actual first argument at runtime is public_token.

(Also noticed in the same comment: connecter should be connected.)

Impact

Developers reading the TypeScript source or generated .d.ts declarations see public_key and may confuse it with the deprecated public-key authentication credential. The correct term public_token is what they exchange via /link/token/exchange.

Suggested fix

One-line change to the comment on line 93 (plus the adjacent connecterconnected typo on line 92):

-  // A function that is called when a user has successfully connecter an Item.
-  // The function should expect two arguments, the public_key and a metadata object
+  // A function that is called when a user has successfully connected an Item.
+  // The function should expect two arguments, the public_token and a metadata object

Happy to send a PR.

Notes

  • The actual TypeScript type PlaidLinkOnSuccess (defined earlier in the same file) correctly uses public_token — this is purely a comment inconsistency.
  • Reference: Plaid Link Token migration guide uses public_token throughout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions