-
-
Notifications
You must be signed in to change notification settings - Fork 237
Fix/ts error #598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/ts error #598
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -72,9 +72,15 @@ export class SensitiveInfoError extends Error { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: string, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options?: { cause?: unknown } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| super(message, options) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| super(message) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.name = 'SensitiveInfoError' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.code = code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Assign `cause` directly instead of passing it to `super()` so this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // the second `Error` constructor argument was introduced). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (options && 'cause' in options) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ;(this as { cause?: unknown }).cause = options.cause | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+78
to
+82
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Assign `cause` directly instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced). | |
| if (options && 'cause' in options) { | |
| ;(this as { cause?: unknown }).cause = options.cause | |
| // Define `cause` manually instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced), while keeping | |
| // it non-enumerable like the native ES2022 `Error` constructor does. | |
| if (options && 'cause' in options) { | |
| Object.defineProperty(this, 'cause', { | |
| value: options.cause, | |
| writable: true, | |
| configurable: true, | |
| }) |
Copilot
AI
Apr 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is intended to preserve cause support under TS libs < ES2022, but there’s no test asserting that SensitiveInfoError (and subclasses via toSensitiveInfoError) actually retain the passed cause. Please add a Jest test that constructs one of these errors with a cause and verifies err.cause is set (and ideally that it’s non-enumerable if you align with the native behavior).
| // Assign `cause` directly instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced). | |
| if (options && 'cause' in options) { | |
| ;(this as { cause?: unknown }).cause = options.cause | |
| // Define `cause` manually instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced), while still | |
| // matching native `Error` behavior by keeping `cause` non-enumerable. | |
| if (options && 'cause' in options) { | |
| Object.defineProperty(this, 'cause', { | |
| value: options.cause, | |
| writable: true, | |
| configurable: true, | |
| enumerable: false, | |
| }) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,10 +38,16 @@ export class HookError extends Error { | |||||||||||||||||||||||||||||||||
| message: string, | ||||||||||||||||||||||||||||||||||
| { cause, operation, hint }: HookErrorOptions = {} | ||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||
| super(message, { cause }) | ||||||||||||||||||||||||||||||||||
| super(message) | ||||||||||||||||||||||||||||||||||
| this.name = 'HookError' | ||||||||||||||||||||||||||||||||||
| this.operation = operation | ||||||||||||||||||||||||||||||||||
| this.hint = hint | ||||||||||||||||||||||||||||||||||
| // Assign `cause` directly instead of passing it to `super()` so this | ||||||||||||||||||||||||||||||||||
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | ||||||||||||||||||||||||||||||||||
| // the second `Error` constructor argument was introduced). | ||||||||||||||||||||||||||||||||||
| if (cause !== undefined) { | ||||||||||||||||||||||||||||||||||
| ;(this as { cause?: unknown }).cause = cause | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+45
to
+49
|
||||||||||||||||||||||||||||||||||
| // Assign `cause` directly instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced). | |
| if (cause !== undefined) { | |
| ;(this as { cause?: unknown }).cause = cause | |
| // Define `cause` explicitly instead of passing it to `super()` so this | |
| // compiles cleanly under TS configs whose `lib` predates ES2022 (where | |
| // the second `Error` constructor argument was introduced), while keeping | |
| // the property non-enumerable like standard errors. | |
| if (cause !== undefined) { | |
| Object.defineProperty(this, 'cause', { | |
| value: cause, | |
| writable: true, | |
| configurable: true, | |
| enumerable: false, | |
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
release-it.git.requireBranchonly allowsmaster/next, but the repo workflows (e.g..github/workflows/test.yml) are configured to run onmain, which strongly suggestsmainis the default branch. As written, a workflow_dispatch release from the default branch will fail the branch check—consider updatingrequireBranchto includemain(or aligning all workflows/branching onmaster).