Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@chaance
Copy link
Contributor

@chaance chaance commented Aug 25, 2025

Description

This was accidentally typed as a single-item tuple, so passing multiple scopes currently results in a type error.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@chaance chaance requested a review from a team as a code owner August 25, 2025 16:21
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR fixes a TypeScript type definition bug in the widgets module's token generation functionality. The issue was in the GetTokenOptions and SerializedGetTokenOptions interfaces where the scopes property was incorrectly typed as a single-item tuple [WidgetScope] instead of an array WidgetScope[].

The problem manifested as TypeScript compilation errors when developers tried to pass multiple widget scopes to the token generation function. While the underlying implementation and serialization logic were already designed to handle arrays of scopes correctly, the type definitions were preventing this intended usage.

This change integrates seamlessly with the existing codebase architecture - the widgets module follows the same pattern as other WorkOS SDK modules with interfaces defining options and their serialized counterparts. The serialization function (serializeGetTokenOptions) was already correctly implemented to handle scope arrays, confirming that this was purely a type definition oversight rather than a logic issue.

Confidence score: 5/5

  • This PR is extremely safe to merge with virtually no risk of breaking existing functionality
  • Score reflects a simple type correction that aligns TypeScript definitions with existing runtime behavior and intended API design
  • No files require special attention as this is a straightforward type fix with clear intent

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@chaance chaance merged commit a221189 into main Aug 25, 2025
5 checks passed
@chaance chaance deleted the chance/fix-widget-scopts-type branch August 25, 2025 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants