Uh oh!
There was an error while loading. Please reload this page.
feat(core,prompts): export CANCEL_SYMBOL - #576
Conversation
isCancel() identifies cancellation values but the underlying symbol was not exported, making a few things unnecessarily difficult: - Tests cannot create a synthetic cancel value that behaves like clack's own cancel result without re-implementing the internals - Return types of prompts use the broad `symbol` type rather than a precise branded type - isCancel() narrowed to `symbol` instead of a specific cancel type Fixesbombshell-dev#554 Changes: - Added `CancelSymbol` type alias (`typeof CANCEL_SYMBOL`) in core utils - Updated `isCancel` guard to narrow to `CancelSymbol` instead of `symbol` - Exported `CANCEL_SYMBOL` and `CancelSymbol` from `@clack/core` - Re-exported both from `@clack/prompts` Usage after this change: ```ts import { CANCEL_SYMBOL, isCancel } from '@clack/prompts' import type { CancelSymbol } from '@clack/prompts' const result = await text({ message: 'Name?' }) if (isCancel(result)) { // result is now narrowed to CancelSymbol, not the broad symbol type } // Tests can now create a synthetic cancel without internal knowledge: const cancelled: CancelSymbol = CANCEL_SYMBOL ```
🦋 Changeset detectedLatest commit: 0d07873 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
43081j
commented
Jun 25, 2026
please follow the PR template provided rather than whatever your agent output: i also don't think we need to export the type as it can very easily be inferred via |
luisangelrod
commented
Jun 25, 2026
Thanks for the feedback. Updated the PR description to follow the template and simplified the change to just export CANCEL_SYMBOL without the explicit type. |
| "@clack/prompts": minor | ||
| --- | ||
| Export `CANCEL_SYMBOL` constant and `CancelSymbol` type from both packages. |
There was a problem hiding this comment.
you can discard this changeset now
| "@clack/prompts": minor | ||
| --- | ||
| Export `CANCEL_SYMBOL` constant and `CancelSymbol` type from `@clack/core` and `@clack/prompts`. Update `isCancel` type guard to narrow to `CancelSymbol` instead of the broad `symbol` type. |
There was a problem hiding this comment.
and this one no longer needs to mention the type
oaksprout
commented
Jul 29, 2026
We can run this PR through an independent check if you want. The diff is applied to a clean copy at its base commit, your test suite and typechecks run in a locked-down container, and a separate pass reviews the change against #554. Results come back as a comment with a record you can inspect. Free, no obligation, and we don't touch the PR itself. AI agents do the checking; a human reviews everything before it's posted and answers replies. If that's useful, say so. If not, ignore this and we won't post again. |
What does this PR do?
Exports
CANCEL_SYMBOLfrom@clack/coreand@clack/promptsso consumers can reference the symbol directly without reimplementing it.Closes#554
Type of change
Checklist
pnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure