Skip to content

fix(builder): add explicit return type to _setClause() for isolatedDe…#92

Merged
productdevbook merged 1 commit into
productdevbook:mainfrom
Markxuxiao:fix/soft-delete-builder-isolated-declarations
Apr 26, 2026
Merged

fix(builder): add explicit return type to _setClause() for isolatedDe…#92
productdevbook merged 1 commit into
productdevbook:mainfrom
Markxuxiao:fix/soft-delete-builder-isolated-declarations

Conversation

@Markxuxiao
Copy link
Copy Markdown
Contributor

Title:
fix(builder): add explicit return type to _setClause() for isolatedDeclarations

Body:

Summary

  • Add explicit return type { column: string; value: ExpressionNode }[] to
    SoftDeleteBuilder._setClause() and RestoreBuilder._setClause() in
    src/builder/soft-delete.ts

Root Cause

obuild's transformSync (oxc) fails with TS9017: Only const arrays can be inferred with --isolatedDeclarations when _setClause() returns a shorthand object literal inside an
array without an explicit return type. This causes the file to be silently skipped during the
build, leaving dist/builder/soft-delete.mjs missing.

Fix

-  protected _setClause() {
+  protected _setClause(): { column: string; value: ExpressionNode }[] {
     return [{ column: this._cfg.column, value: deletedValue(this._cfg) }]
   }

Test plan

- pnpm build produces dist/builder/soft-delete.mjs
- dist/index.mjs correctly imports from ./builder/soft-delete.mjs
- No more TS9017 errors for this file

---

…clarations

obuild's transformSync fails with TS9017 when _setClause() infers a
shorthand object literal inside an array literal under
--isolatedDeclarations. Adding the explicit return type
{ column: string; value: ExpressionNode }[] resolves the build error
and ensures dist/builder/soft-delete.mjs is emitted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Markxuxiao
Copy link
Copy Markdown
Contributor Author

我下载最新0.0.13版本使用时报错,提示缺少文件, 我本地打包确实证实少了文件 builder/soft-delete.mjs 按上面修复之后就打包没问题了

@productdevbook productdevbook merged commit 06162e9 into productdevbook:main Apr 26, 2026
1 check passed
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.

3 participants