Skip to content

Conversation

@thomaswhyyou
Copy link
Contributor

@thomaswhyyou thomaswhyyou commented Aug 20, 2025

Description

Adds a generic type parameter for typing guide step contents, which users can pass in when using the useGuide(s) hooks or calling the selecteGuide(s) methods in the guide client.

Note, there is a corresponding CLI PR (knocklabs/knock-cli#575) to add a new knock guide generate-types command which generates types for all guides in a given environment automatically.

@vercel
Copy link

vercel bot commented Aug 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
javascript-ms-teams-connect-example Ready Ready Preview Comment Sep 3, 2025 7:33pm
javascript-nextjs-example Ready Ready Preview Comment Sep 3, 2025 7:33pm
javascript-slack-connect-example Ready Ready Preview Comment Sep 3, 2025 7:33pm
javascript-slack-kit-example Ready Ready Preview Comment Sep 3, 2025 7:33pm

@linear
Copy link

linear bot commented Aug 20, 2025

@changeset-bot
Copy link

changeset-bot bot commented Aug 20, 2025

⚠️ No Changeset found

Latest commit: 0907b4e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@thomaswhyyou thomaswhyyou changed the title another simpler but less convinient approach feat: add content type generic for guide step content Sep 3, 2025
@thomaswhyyou thomaswhyyou force-pushed the thomas-kno-8284-sdk-typing-in-the-react-sdk-for-the-useguide-hook-6 branch from ef48f6c to c3a5cdc Compare September 3, 2025 04:21
@thomaswhyyou thomaswhyyou marked this pull request as ready for review September 3, 2025 14:32
cursor[bot]

This comment was marked as outdated.

//

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Any = any;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if unknown is better than any here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was on the fence about that but decided to keep it as any for this PR. I understand unknown is considered a "safer" choice, but I'm afraid it would end up adding a lot of boilerplate/annoyance in practice..

Besides, it was initially typed as any so switching to unknown here would technically be a breaking change? I'm definitely open to the idea, but I suspect it's better handled as a separate version if we do decide to make that change.

@codecov
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.74%. Comparing base (b8b64e4) to head (0907b4e).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ges/react-core/src/modules/guide/hooks/useGuide.ts 25.00% 3 Missing ⚠️
...es/react-core/src/modules/guide/hooks/useGuides.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #722      +/-   ##
==========================================
+ Coverage   63.73%   63.74%   +0.01%     
==========================================
  Files         185      185              
  Lines        7450     7458       +8     
  Branches      879      879              
==========================================
+ Hits         4748     4754       +6     
- Misses       2676     2678       +2     
  Partials       26       26              
Files with missing lines Coverage Δ
packages/client/src/clients/guide/client.ts 90.62% <100.00%> (+0.08%) ⬆️
packages/client/src/clients/guide/types.ts 100.00% <ø> (ø)
...es/react-core/src/modules/guide/hooks/useGuides.ts 25.00% <33.33%> (ø)
...ges/react-core/src/modules/guide/hooks/useGuide.ts 16.66% <25.00%> (-2.09%) ⬇️

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.

4 participants