Skip to content

Prepare 2.0.1#81

Merged
baxyz merged 7 commits into
mainfrom
for_2_0_0-2
Jun 3, 2026
Merged

Prepare 2.0.1#81
baxyz merged 7 commits into
mainfrom
for_2_0_0-2

Conversation

@baxyz

@baxyz baxyz commented May 30, 2026

Copy link
Copy Markdown
Contributor
  • add tests for isBigInt
  • add tests for isBlob
  • add tests for isBoolean
  • add tests for isBuffer
  • add tests for isDate
  • add tests for isDefined
  • add tests for isError
  • add tests for isFalsy
  • add tests for isFormData
  • add tests for isFunction
  • add tests for isIterable
  • add tests for isMap
  • add tests for isNegativeNumber
  • add tests for isNonEmptyArray
  • add tests for isNonEmptyString
  • add tests for isNull
  • add tests for isNullish
  • add tests for isNumber
  • add tests for isPlainObject
  • add tests for isPositiveNumber
  • add tests for isPrimitive
  • add tests for isPromise
  • add tests for isRegExp
  • add tests for isString
  • add tests for isSymbol
  • add tests for isTemporalDuration
  • add tests for isTemporalInstant
  • add tests for isTemporalPlainDate
  • add tests for isTemporalPlainDateTime
  • add tests for isTemporalPlainTime
  • add tests for isTemporalZonedDateTime
  • add tests for isTimestamp
  • add tests for isTruthy
  • add tests for isUndefined
  • add tests for isValidDate

Description

Please include a summary of what this PR does and why it's needed.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring
  • Test improvement

Related Issues

Closes #(issue number)

How Has This Been Tested?

Describe the tests you ran and how to reproduce them:

  • Test A
  • Test B

Checklist

  • My code follows the code style of this project
  • I have updated the documentation accordingly
  • I have added tests for my changes
  • All new and existing tests passed locally
  • My commits follow the conventional commit format

Screenshots (if applicable)

Add screenshots for UI changes.

Additional Context

Add any other context about the PR here.

Copilot AI review requested due to automatic review settings May 30, 2026 22:29

Copilot AI 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.

Pull request overview

This PR adds a small "narrowing in if/else" describe block to each is* type-guard spec file under helpers/type/, using expectTypeOf from Vitest to verify that the predicates narrow values correctly inside truthy branches. It complements the existing property-based and contract test suites without modifying any production code.

Changes:

  • Imports expectTypeOf from vitest in 33 *.spec.ts files.
  • Adds a uniform describe('<guard> — narrowing in if/else', …) block per file asserting the narrowed type and a runtime sanity check.
  • Adds named type imports (type Falsy, type Primitive) where needed for the assertions.

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated no comments.

Show a summary per file
File Description
helpers/type/isArray.spec.ts Asserts narrowing to unknown[]
helpers/type/isArrayBuffer.spec.ts Asserts narrowing to ArrayBuffer
helpers/type/isAsyncFunction.spec.ts Asserts narrowing to (...args: unknown[]) => Promise<unknown>
helpers/type/isBigInt.spec.ts Asserts narrowing to bigint
helpers/type/isBlob.spec.ts Asserts narrowing to Blob
helpers/type/isBoolean.spec.ts Asserts narrowing to boolean
helpers/type/isBuffer.spec.ts Asserts narrowing to Buffer
helpers/type/isDate.spec.ts Asserts narrowing to Date
helpers/type/isDefined.spec.ts Asserts removal of null/undefined from union
helpers/type/isError.spec.ts Asserts narrowing to Error
helpers/type/isFalsy.spec.ts Imports Falsy; asserts narrowing to Falsy
helpers/type/isFormData.spec.ts Asserts narrowing to FormData
helpers/type/isFunction.spec.ts Asserts narrowing to Function (with ban-types disable)
helpers/type/isIterable.spec.ts Asserts narrowing to Iterable<unknown>
helpers/type/isMap.spec.ts Asserts narrowing to Map<unknown, unknown>
helpers/type/isNegativeNumber.spec.ts Asserts narrowing to number
helpers/type/isNonEmptyArray.spec.ts Asserts narrowing to [unknown, ...unknown[]]
helpers/type/isNonEmptyString.spec.ts Asserts narrowing to string
helpers/type/isNull.spec.ts Asserts narrowing to null
helpers/type/isNullish.spec.ts Asserts narrowing to null | undefined
helpers/type/isNumber.spec.ts Asserts narrowing to number
helpers/type/isPlainObject.spec.ts Asserts narrowing to Record<string, unknown>
helpers/type/isPositiveNumber.spec.ts Asserts narrowing to number
helpers/type/isPrimitive.spec.ts Imports Primitive; asserts narrowing to Primitive
helpers/type/isPromise.spec.ts Asserts narrowing to PromiseLike<unknown>
helpers/type/isRegExp.spec.ts Asserts narrowing to RegExp
helpers/type/isString.spec.ts Asserts narrowing to string
helpers/type/isSymbol.spec.ts Asserts narrowing to symbol
helpers/type/isTemporalDuration.spec.ts Asserts narrowing to Temporal.Duration
helpers/type/isTemporalInstant.spec.ts Asserts narrowing to Temporal.Instant
helpers/type/isTemporalPlainDate.spec.ts Asserts narrowing to Temporal.PlainDate
helpers/type/isTemporalPlainDateTime.spec.ts Asserts narrowing to Temporal.PlainDateTime
helpers/type/isTemporalPlainTime.spec.ts Asserts narrowing to Temporal.PlainTime
helpers/type/isTemporalZonedDateTime.spec.ts Asserts narrowing to Temporal.ZonedDateTime
helpers/type/isTimestamp.spec.ts Asserts narrowing to number
helpers/type/isTruthy.spec.ts Asserts removal of Falsy from union
helpers/type/isUndefined.spec.ts Asserts narrowing to undefined
helpers/type/isValidDate.spec.ts Asserts narrowing to Date

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

baxyz added 5 commits June 2, 2026 21:53
- add tests for isBigInt
- add tests for isBlob
- add tests for isBoolean
- add tests for isBuffer
- add tests for isDate
- add tests for isDefined
- add tests for isError
- add tests for isFalsy
- add tests for isFormData
- add tests for isFunction
- add tests for isIterable
- add tests for isMap
- add tests for isNegativeNumber
- add tests for isNonEmptyArray
- add tests for isNonEmptyString
- add tests for isNull
- add tests for isNullish
- add tests for isNumber
- add tests for isPlainObject
- add tests for isPositiveNumber
- add tests for isPrimitive
- add tests for isPromise
- add tests for isRegExp
- add tests for isString
- add tests for isSymbol
- add tests for isTemporalDuration
- add tests for isTemporalInstant
- add tests for isTemporalPlainDate
- add tests for isTemporalPlainDateTime
- add tests for isTemporalPlainTime
- add tests for isTemporalZonedDateTime
- add tests for isTimestamp
- add tests for isTruthy
- add tests for isUndefined
- add tests for isValidDate
- update return type to act as a type guard
- add examples for type narrowing in else branch
- add node helper category
- update contributing and readme files
- create config for node utilities
- implement isBuffer function to check Node.js Buffer instances
- add property-based and contract tests for isBuffer
- create example usage for isBuffer in Node.js context
baxyz and others added 2 commits June 2, 2026 22:00
The coherency check requires that peer dep versions in built packages
match the root package.json exactly. Config-declared peer deps were
using their own version range (>=22) instead of the root's (^25.9.1).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
isEmpty: extend type predicate to ReadonlyMap<never,never> | ReadonlySet<never>
so Map/Set narrowing works in the true branch. Plain objects remain excluded
(no precise TypeScript representation for "empty object").

Peer deps: coherency check now skips peerDependencies — they are consumer-facing
semver constraints (e.g. @types/node >=22 = oldest LTS) intentionally different
from root dev-tooling versions. prepareCategoryPackageJson uses config.json
versions as-is instead of overriding with the root version.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@baxyz baxyz merged commit 9141377 into main Jun 3, 2026
15 checks passed
@baxyz baxyz deleted the for_2_0_0-2 branch June 3, 2026 18:52
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