Skip to content

Fix/ts error#598

Merged
mCodex merged 3 commits intomasterfrom
fix/tsError
Apr 29, 2026
Merged

Fix/ts error#598
mCodex merged 3 commits intomasterfrom
fix/tsError

Conversation

@mCodex
Copy link
Copy Markdown
Owner

@mCodex mCodex commented Apr 29, 2026

This pull request makes several improvements to the release process, error handling, and dependency management. The most significant changes include migrating from semantic-release to release-it for automated releases, updating error classes for better TypeScript compatibility, and upgrading several dependencies. The release workflow has been enhanced to allow manual version increments and dry runs, and the configuration has been streamlined by consolidating release settings into package.json.

Release process migration and workflow improvements:

  • Migrated from semantic-release to release-it for automated releases, including removing the release.config.cjs and .release-it.json files, updating the release script, and adding a comprehensive release-it configuration to package.json. This includes changelog generation via @release-it/conventional-changelog and ensures releases only occur from master or next branches. [1] [2] [3] [4] [5]

  • Enhanced the GitHub Actions release workflow (.github/workflows/release.yml) to support manual version increments and dry runs, set up proper git identity for automated commits, and improved environment variable handling for publishing. [1] [2]

Error handling improvements:

  • Updated SensitiveInfoError and HookError classes to assign the cause property directly, ensuring compatibility with TypeScript configurations that do not include the ES2022 Error constructor signature. [1] [2]

Dependency and version updates:

  • Upgraded react-native-nitro-modules and nitrogen dependencies to version 0.35.6 in both the main and example projects. [1] [2]
  • Updated the package version to 6.1.1 and added a corresponding changelog entry for the bug fix regarding error class compatibility. [1] [2]

These changes streamline the release process, improve compatibility with various TypeScript environments, and keep dependencies up to date.

mCodex added 3 commits April 29, 2026 09:20
Replace semantic-release with release-it and update the release workflow. Removed legacy semantic-release configs (.release-it.json and release.config.cjs) and embed a release-it configuration in package.json; updated the npm "release" script to run release-it and adjusted devDependencies accordingly. Updated .github/workflows/release.yml to add workflow_dispatch inputs (increment, dry-run), configure Node registry, persist credentials, set git author identity, install dependencies, and run yarn release with CI flags and forwarded args (including NODE_AUTH_TOKEN and NPM_CONFIG_PROVENANCE). Regenerated yarn.lock to reflect dependency changes.
Copilot AI review requested due to automatic review settings April 29, 2026 12:27
@mCodex mCodex merged commit 1211c3c into master Apr 29, 2026
10 checks passed
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 project’s release automation and TypeScript compatibility by migrating from semantic-release to release-it, adjusting error classes to avoid relying on the ES2022 Error constructor signature, and bumping related dependencies/versions.

Changes:

  • Replace semantic-release setup with release-it and consolidate release configuration into package.json.
  • Update SensitiveInfoError and HookError to assign cause without using Error(message, { cause }) (TS lib compatibility).
  • Upgrade nitrogen / react-native-nitro-modules and refresh the lockfile; bump version to 6.1.1 with a changelog entry.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Switch release scripts/deps to release-it and add embedded release-it config; bump version + dependency updates.
.github/workflows/release.yml Enhance manual release workflow with increment + dry-run inputs and updated env handling.
src/errors.ts Adjust typed error base class to assign cause manually for older TS lib compatibility.
src/hooks/types.ts Adjust hook error wrapper to assign cause manually for older TS lib compatibility.
CHANGELOG.md Add 6.1.1 entry for the TypeScript cause compatibility fix.
example/package.json Bump react-native-nitro-modules to 0.35.6.
yarn.lock Lockfile updates reflecting release/dependency changes and upgrades.
release.config.cjs Remove old semantic-release configuration.
.release-it.json Remove standalone release-it config now embedded in package.json.

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

Comment thread src/errors.ts
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
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

Assigning cause via direct property assignment makes it enumerable, which differs from the native ES2022 Error constructor behavior (where cause is non-enumerable). Consider using Object.defineProperty(this, 'cause', { value: options.cause, configurable: true }) (and keep it non-enumerable) to better match standard error semantics while retaining TS compatibility.

Suggested change
// 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 uses AI. Check for mistakes.
Comment thread src/errors.ts
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
Copy link

Copilot AI Apr 29, 2026

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).

Suggested change
// 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,
})

Copilot uses AI. Check for mistakes.
Comment thread src/hooks/types.ts
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
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

Same as in SensitiveInfoError: assigning cause directly makes it enumerable and diverges from the ES2022 Error constructor’s cause semantics. Prefer defining cause with Object.defineProperty (non-enumerable) so consumer logging/serialization behavior matches standard errors.

Suggested change
// 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,
})

Copilot uses AI. Check for mistakes.
Comment thread package.json
"tagName": "v${version}",
"tagAnnotation": "Release v${version}",
"requireCleanWorkingDir": true,
"requireBranch": [
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

release-it.git.requireBranch only allows master/next, but the repo workflows (e.g. .github/workflows/test.yml) are configured to run on main, which strongly suggests main is the default branch. As written, a workflow_dispatch release from the default branch will fail the branch check—consider updating requireBranch to include main (or aligning all workflows/branching on master).

Suggested change
"requireBranch": [
"requireBranch": [
"main",

Copilot uses AI. Check for mistakes.
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.

2 participants