Skip to content

Started using @tryghost/errors types#28644

Draft
EvanHahn wants to merge 1 commit into
mainfrom
tryghost-errors-has-types
Draft

Started using @tryghost/errors types#28644
EvanHahn wants to merge 1 commit into
mainfrom
tryghost-errors-has-types

Conversation

@EvanHahn

@EvanHahn EvanHahn commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

towards https://linear.app/ghost/issue/NY-1340

Depends on #28648.

@tryghost/errors has types. Let's use them.

I think this change is useful on its own, but it's also useful for an upcoming change which uses these types.

towards https://linear.app/ghost/issue/NY-1340

`@tryghost/errors` has types. Let's use them.

I think this change is useful on its own, but it's also useful for an upcoming change which uses these types.
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The ambient TypeScript module declaration declare module '@tryghost/errors'; is removed from ghost/core/core/server/services/recommendations/service/libraries.d.ts. The remaining four declarations (@tryghost/tpl, @tryghost/logging, @tryghost/mongo-utils, @tryghost/nql) are left intact.

Possibly related PRs

  • TryGhost/Ghost#28442: Removes the same stale declare module '@tryghost/errors'; ambient shim from a different libraries.d.ts file in the codebase.
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title states 'Started using @tryghost/errors types' but the actual change removes the ambient module declaration, which stops overwriting types. The title is misleading about the direction of the change. Revise the title to accurately reflect the change, such as 'Remove ambient @tryghost/errors module declaration' or 'Stop overwriting @tryghost/errors types'.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly relates to the changeset: removing the ambient module declaration for @tryghost/errors to use the package's existing types instead.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tryghost-errors-has-types

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@EvanHahn EvanHahn changed the title Stopped overwriting @tryghost/errors types Started using @tryghost/errors types Jun 16, 2026
@EvanHahn EvanHahn enabled auto-merge (squash) June 16, 2026 21:11
@nx-cloud

nx-cloud Bot commented Jun 16, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 1481437

Command Status Duration Result
nx run ghost:test:ci:e2e:no-coverage ❌ Failed 28s View ↗
nx run-many -t lint -p ghost ❌ Failed 43s View ↗
nx run ghost:build:tsc ❌ Failed 5s View ↗
nx run-many --target=build --projects=@tryghost... ✅ Succeeded <1s View ↗

💡 Dealing with memory or CPU issues? See memory and CPU details with the resource usage add-on ↗.


☁️ Nx Cloud last updated this comment at 2026-06-16 21:14:22 UTC

@EvanHahn EvanHahn marked this pull request as draft June 16, 2026 21:53
auto-merge was automatically disabled June 16, 2026 21:53

Pull request was converted to draft

EvanHahn added a commit that referenced this pull request Jun 16, 2026
towards https://linear.app/ghost/issue/NY-1340
ref #28644

This change should have no user impact.

`RedirectsService` had a few type errors:

- A number of errors weren't necessarily `Error`s. I added a function,
  `errify` to convert `unknown` to `Error`. (I think this function will
  be useful elsewhere.)

- A `ValidationError` was being created with an invalid `context`.

I think these are useful improvements on their own, but it'll also
unblock [an upcoming change][0] in a seemingly-unrelated area.

[0]: #28644
EvanHahn added a commit that referenced this pull request Jun 16, 2026
towards https://linear.app/ghost/issue/NY-1340
ref #28644

This change should have no user impact.

`RedirectsService` had a few type errors:

- A number of errors weren't necessarily `Error`s. I added a function,
  `errify` to convert `unknown` to `Error`. (I think this function will
  be useful elsewhere.)

- A `ValidationError` was being created with an invalid `context`.

I think these are useful improvements on their own, but it'll also
unblock [an upcoming change][0] in a seemingly-unrelated area.

[0]: #28644
EvanHahn added a commit that referenced this pull request Jun 16, 2026
towards https://linear.app/ghost/issue/NY-1340
ref #28644

This change should have no user impact.

`RedirectsService` had a few type errors:

- A number of errors weren't necessarily `Error`s. I added a function,
  `errify` to convert `unknown` to `Error`. (I think this function will
  be useful elsewhere.)

- A `ValidationError` was being created with an invalid `context`.

I think these are useful improvements on their own, but it'll also
unblock [an upcoming change][0] in a seemingly-unrelated area.

[0]: #28644
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.

1 participant