Releases: noshiro-pf/ts-data-forge
Release list
eslint-plugin-ts-data-forge@0.2.0
Minor Changes
-
534ac4d:
Arr.isEmptyandArr.isNonEmptynow narrow to the branded length-constrained
array types, matching the rest of theArrlength-guard family.guard before after Arr.isEmpty(xs)readonly []FixedLengthArray<0, E> & XsArr.isNonEmpty(xs)NonEmptyArray<E>MinLengthArray<1, E> & XsisEmptywas missing the brand entirely, so it was not equivalent to
Arr.isFixedLengthArray(xs, 0);isNonEmptyhad the brand but dropped the input
type instead of intersecting with it the wayArr.isMinLengthArraydoes. Both
now behave exactly like theiris*LengthArraycounterparts.BREAKING CHANGE: the narrowed types are strictly narrower than before. Code that
reads the narrowed value keeps compiling, but an explicit annotation such as
const empty: readonly [] = xsafter the guard, or passing the narrowed value
where an unbranded array literal is expected, may now need the unbranded type
spelled out.prefer-canonical-length-guardfollows the new semantics:isFixedLengthArray(xs, 0)
andisMinLengthArray(xs, 1)are now the type-identical rewrites, and the
structural*Tupleguards (isFixedLengthTuple(xs, 0),isMaxLengthTuple(xs, 0),
isBoundedLengthTuple(xs, 0, 0),isMinLengthTuple(xs, 1)) are rewritten too —
those strengthen the narrowed type by adding the brand.prefer-canonical-length-guardadditionally absorbs the fivexs.length <op> n
comparison rules —prefer-arr-is-non-empty,prefer-arr-is-min-length-array,
prefer-arr-is-max-length-array,prefer-arr-is-bounded-length-arrayand
prefer-arr-is-fixed-length-array— so one rule now covers both
comparison → guard and guard → guard normalization.BREAKING CHANGE: those five rule names are removed from the plugin; enable
ts-data-forge/prefer-canonical-length-guardinstead. Their behavior is
unchanged — the rule reuses their implementations rather than reimplementing
them. -
9dd4194: Ship a
recommendedconfig preset.eslintPluginTsDataForge.configs.recommended
is a flat-config object that registers the plugin and enables every rule at
error, so consuming projects can start from:export default [eslintPluginTsDataForge.configs.recommended];
The preset registers the exported plugin object itself, so listing the plugin in
your ownpluginsrecord alongside the preset does not trigger ESLint's
Cannot redefine pluginerror.Also exports the
ESLintFlatConfigtype alongside the existingESLintPlugin. -
534ac4d: Add the
prefer-canonical-length-guardrule, which normalizes degenerateArr
length guards to their canonical spelling:Arr.isFixedLengthTuple(xs, 0),Arr.isMaxLengthTuple(xs, 0)and
Arr.isBoundedLengthTuple(xs, 0, 0)→Arr.isEmpty(xs)Arr.isMinLengthArray(xs, 1)→Arr.isNonEmpty(xs)
Every rewrite narrows to exactly the same type, so the autofix is
type-preserving.
Patch Changes
- Updated dependencies [534ac4d]
- ts-data-forge@13.0.0
ts-data-forge@12.2.2
eslint-plugin-ts-data-forge@0.1.7
Patch Changes
- 8ef64f1: chore(deps): bump actions/checkout from 7.0.0 to 7.0.1
- 37cedcb: chore(deps): bump actions/setup-node from 6.4.0 to 7.0.0
- 6cb1c29: chore(deps): bump anthropics/claude-code-action from 1.0.177 to 1.0.178
- Updated dependencies [8ef64f1]
- Updated dependencies [37cedcb]
- Updated dependencies [6cb1c29]
- ts-data-forge@12.2.2
ts-data-forge@12.2.1
Patch Changes
- 59bfcbe: Fix how dependencies are specified.
eslint-plugin-ts-data-forge@0.1.6
ts-data-forge@12.2.0
Minor Changes
- 36b9be2: Make toPushed/toUnshifted return types assignable to NonEmptyArray
eslint-plugin-ts-data-forge@0.1.5
Patch Changes
- Updated dependencies [36b9be2]
- ts-data-forge@12.2.0
ts-data-forge@12.1.0
Minor Changes
- 1bf4200: Add curried overloads and NonEmpty specializations to length validators
ts-data-forge@12.0.0
Major Changes
-
db6c5f5: Rename the branded-number namespaces'
clampoperator tofromNumber.Every branded number type (
Int16,Uint8,PositiveFiniteNumber, …) exposed a
one-argumentclamp(x: number)that coerces an arbitrarynumberinto the type's
domain by saturating it into[MIN_VALUE, MAX_VALUE](and rounding to the nearest
integer, for integer types). This is a total domain projection — the counterpart of
theis*guard and the throwingas*cast — not the usual three-argument
clamp(value, lo, hi), and the name collided withNum.clamp(the curried range
clamp) and the array slice-clamp helpers. It is now namedfromNumber, which
matches what it does and reads correctly even for open-domain types such as
PositiveFiniteNumber, where there is no natural[lo, hi]range.Num.clampand the array slice-clamped utilities are unchanged.The
MIN_VALUE/MAX_VALUEconstants are unchanged; their JSDoc now clarifies that
for open-domain types they are the nearest representable in-domain value (the
saturation target offromNumber), not the mathematical bound.BREAKING CHANGE: replace
<Type>.clamp(x)with<Type>.fromNumber(x)for every
branded number type — e.g.Int16.clamp(100_000)becomes
Int16.fromNumber(100_000).Num.clampis not affected.
ts-data-forge@11.0.1
Patch Changes
-
aec5752: Generate the remaining branded-number modules — the 6
operatorsForFloat
families (FiniteNumber,NonNegative/NonPositive/NonZero/Positive/
Negativefinite numbers) and the 2enummodules (Int8,Uint8) — from the
same declarative generator that already produces the integer modules, so all 34
branded-number modules are now generated. The generated code is structurally
identical to the previous hand-written modules (verified by a comment-stripped
diff), so the runtime and type surface are unchanged; only the JSDoc prose is
templated (with per-member overrides preserving design-intent notes such as why
add/subare absent fromNonZeroFiniteNumber). Worked@exampleblocks are
still embedded fromsamples/.With every branded-number type now generated, the
check:branded-number-casts
guard is removed — consistency is enforced by generation. -
bf3466d: Generate the branded-number integer modules (
Int,Uint,SafeInt, the
Int16/32,Uint16/32,NonNegative*,Positive*,NonZero*,NonPositive*
andNegative*families — 26 modules) from a declarative config
(scripts/gen-branded-number) instead of maintaining them by hand. The
generated code is structurally identical to the previous hand-written modules
(same factory calls,is/as, namespace objects andexpectTypeassertions),
so the runtime and type surface are unchanged; only the JSDoc prose is now
produced from flag-driven templates for consistency, with worked@example
blocks still embedded fromsamples/. Generation runs as part of the build.The
operatorsForFloatfamilies and the twoenummodules remain hand-written
for now and continue to be covered bycheck:branded-number-casts.