Skip to content

feat(react,js): improve ActiveBlock TS type#683

Merged
VojtechVidra merged 3 commits into
mainfrom
feat/improve-active-block-type
May 27, 2026
Merged

feat(react,js): improve ActiveBlock TS type#683
VojtechVidra merged 3 commits into
mainfrom
feat/improve-active-block-type

Conversation

@VojtechVidra
Copy link
Copy Markdown
Member

@VojtechVidra VojtechVidra commented May 25, 2026

Pull request checklist

  • Create and update TSDoc and export relevant TypeScript types
  • Write test for the new/updated features if possible
  • Test manually each SDK for larger UI changes
  • Link issue to this PR
  • Review docs and add or update as needed

@VojtechVidra VojtechVidra requested a review from OPesicka May 25, 2026 12:11
@VojtechVidra VojtechVidra linked an issue May 25, 2026 that may be closed by this pull request
@VojtechVidra VojtechVidra requested a review from Copilot May 25, 2026 13:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the shared SDK ActiveBlock TypeScript typing to be more precise (discriminated union by type), and simplifies React’s blockToActiveBlock construction accordingly.

Changes:

  • Refactors ActiveBlock from a single interface into a discriminated union with per-variant props types (component, tour-component, survey).
  • Improves the TSDoc for tourBlockId and how it should be used for stable rendering keys in tours.
  • Removes an unnecessary as ActiveBlock["type"] cast in the React SDK when constructing ActiveBlock.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
workspaces/shared/src/types/active-block.ts Refactors ActiveBlock typing into a discriminated union and updates tourBlockId documentation.
workspaces/react/src/lib/active-block.ts Removes a redundant type-cast when mapping a workflow block to an ActiveBlock.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread workspaces/shared/src/types/active-block.ts Outdated
Comment thread workspaces/shared/src/types/active-block.ts
@VojtechVidra VojtechVidra merged commit e521255 into main May 27, 2026
7 checks passed
@VojtechVidra VojtechVidra deleted the feat/improve-active-block-type branch May 27, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix active block type

3 participants