Skip to content

Fix optional Validator constructor typings - #126

Merged
vacekj merged 2 commits into
mainfrom
fix-114-optional-validator-constructor
Mar 28, 2026
Merged

Fix optional Validator constructor typings#126
vacekj merged 2 commits into
mainfrom
fix-114-optional-validator-constructor

Conversation

@vacekj

@vacekj vacekj commented Mar 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • make the Validator constructor options parameter optional in the published TypeScript declarations
  • add a TypeScript regression fixture that covers both new Validator() and new Validator({ allErrors: true })
  • update the type-test script to compile the consumer-style fixture

Closes #114


Note

Low Risk
Low risk type-only changes plus a TypeScript fixture to prevent regressions; no runtime logic is modified.

Overview
Updates the published TypeScript declarations so new Validator() is valid by making the Validator constructor options parameter optional.

Adds a small consumer-style TypeScript fixture in types/validator.ts and updates the test:types script to compile it, covering both default and configured constructor usage.

Written by Cursor Bugbot for commit 1c9bfc2. This will update automatically on new commits. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread package.json Outdated
"test": "npm run test:unit && npm run test:types",
"test:unit": "tap",
"test:types": "tsc --noEmit --strict src/index.d.ts",
"test:types": "tsc --noEmit --strict --skipLibCheck types/validator.ts",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

--skipLibCheck silently skips validating own .d.ts declarations

Medium Severity

The test:types script adds --skipLibCheck, which tells TypeScript to skip type-checking all .d.ts files — including the project's own src/index.d.ts. The old script directly validated src/index.d.ts, so internal type errors in the declaration file (e.g., referencing a nonexistent type or structural mistakes) were caught. Now those errors are silently ignored. The test fixture in types/validator.ts only exercises the consumer-facing API surface, not the internal correctness of the declarations.

Fix in Cursor Fix in Web

@cursor

cursor Bot commented Mar 28, 2026

Copy link
Copy Markdown

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@vacekj
vacekj force-pushed the fix-114-optional-validator-constructor branch from 7324e0e to b67b140 Compare March 28, 2026 21:22
@vacekj
vacekj merged commit 1b5d5b4 into main Mar 28, 2026
0 of 3 checks passed
@vacekj
vacekj deleted the fix-114-optional-validator-constructor branch March 28, 2026 21:23
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.

Make options object optional for Validator constructor

1 participant