skyltmax_config 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/lib/skyltmax_config/version.rb +1 -1
- data/package.json +1 -1
- data/tests/reset.types.ts +24 -1
- data/ts-reset.d.ts +14 -5
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da2f3f8ab3aea986a3fbaa3283bddcc1000eaa06ccd88b5dfc65e38d35a6a2c6
|
|
4
|
+
data.tar.gz: f7540ad04b6c664103af5fa28d502b921fc52001e2ff663ff3f76a1d80cacf94
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 85423ebdd5775bb7fbc2f6c6615b0d465eec4d6fd7a04884bacbb7434a686b469dbaf857e74e99cda829b184cb6042441fa2e72eb5e717584b4c3161a9bea08d
|
|
7
|
+
data.tar.gz: a3fa9c943c1e28f64b479eb98106e3617f283e742013b493af475290e6af4fb62768d8065fca453bc2165d8be4ddc15934133ebb3cc5d47cbdfb1693b9250d06
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
### Unreleased
|
|
4
4
|
|
|
5
|
+
### [4.0.1] - 2026-11-11
|
|
6
|
+
|
|
7
|
+
- fix: `.filter(Boolean)` narrows arrays of objects again. 4.0.0 vendored ts-reset 0.7.0's `filter` override verbatim,
|
|
8
|
+
and its `NonFalsy<NoInfer<S>>` return type left any array with object members un-narrowed (`(Obj | null)[]` stayed
|
|
9
|
+
`NoInfer<Obj | null>[]`), rejected correct `.filter(Boolean)` arguments, and broke generic `(U | null)[]`. The
|
|
10
|
+
vendored override now returns `NoInfer<NonFalsy<S>>[]`, which narrows every element type and keeps the inline argument
|
|
11
|
+
check 4.0.0 added. Hovers show `NoInfer<Obj>[]`; it is assignable to `Obj[]`.
|
|
12
|
+
|
|
5
13
|
### [4.0.0] - 2026-11-11
|
|
6
14
|
|
|
7
15
|
Upgrade guide: [docs/migrations/4.0.0.md](docs/migrations/4.0.0.md).
|
data/Gemfile.lock
CHANGED
data/package.json
CHANGED
data/tests/reset.types.ts
CHANGED
|
@@ -34,10 +34,33 @@ export type Checks = [
|
|
|
34
34
|
Expect<Equal<typeof _cloned, HTMLDivElement>>,
|
|
35
35
|
]
|
|
36
36
|
|
|
37
|
-
// filter-boolean
|
|
37
|
+
// filter-boolean on object element types. Upstream 0.7.0's `NonFalsy<NoInfer<S>>` left all of these un-narrowed (4.0.0
|
|
38
|
+
// shipped that); the vendored `NoInfer<NonFalsy<S>>` must keep them assignable. Assignability, not Equal: the result
|
|
39
|
+
// reads `NoInfer<Obj>[]`, which is what consumers' code sees anyway.
|
|
40
|
+
type Obj = { id: string }
|
|
41
|
+
declare const objects: (Obj | null)[]
|
|
42
|
+
declare const mixed: (Obj | string | null | 0 | "")[]
|
|
43
|
+
declare const readonlyObjects: readonly (Obj | undefined)[]
|
|
44
|
+
export const _objects: Obj[] = objects.filter(Boolean)
|
|
45
|
+
export const _mixed: (Obj | string)[] = mixed.filter(Boolean)
|
|
46
|
+
export const _readonlyObjects: Obj[] = readonlyObjects.filter(Boolean)
|
|
47
|
+
export const _chained: string[] = objects.filter(Boolean).map(o => o.id)
|
|
48
|
+
export function _generic<U>(xs: (U | null | undefined)[]): U[] {
|
|
49
|
+
return xs.filter(Boolean)
|
|
50
|
+
}
|
|
51
|
+
declare function takeFirst<U>(xs: U[]): U
|
|
52
|
+
export const _inferred: Obj = takeFirst(objects.filter(Boolean))
|
|
53
|
+
|
|
54
|
+
// filter-boolean inline as an argument still checks the elements (ts-reset#233; 0.6.1 let this compile) …
|
|
38
55
|
declare function pet(animals: readonly { type: string; name: string }[]): void
|
|
39
56
|
// @ts-expect-error — `{ type: "dog" }` is missing `name`
|
|
40
57
|
pet([{ type: "cat", name: "Fluffy" }, { type: "dog" }].filter(Boolean))
|
|
58
|
+
// … and still accepts a correct one (4.0.0 rejected this)
|
|
59
|
+
pet([{ type: "cat", name: "Fluffy" }, null].filter(Boolean))
|
|
60
|
+
|
|
61
|
+
// filter with a normal predicate on a union of arrays still falls through to the built-in overload
|
|
62
|
+
declare const unionOfArrays: string[] | number[]
|
|
63
|
+
void unionOfArrays.filter(x => typeof x === "string")
|
|
41
64
|
|
|
42
65
|
// array-includes: a widened value is accepted without a cast
|
|
43
66
|
literals.includes(widened)
|
data/ts-reset.d.ts
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
// - `promise-catch`, which 0.7.0 itself drops from `recommended`: its extra overload makes `.catch()`/`.then()` on a
|
|
8
8
|
// `Promise<A> | Promise<B>` union a hard TS2349 error (ts-reset#209).
|
|
9
9
|
//
|
|
10
|
+
// One deliberate deviation from upstream: `filter-boolean` returns `NoInfer<NonFalsy<S>>[]` instead of 0.7.0's
|
|
11
|
+
// `NonFalsy<NoInfer<S>>[]` — see the comment on that section.
|
|
12
|
+
//
|
|
10
13
|
// Must stay a global script (no top-level import/export): every declaration here merges into a lib interface.
|
|
11
14
|
// docs/upgrades/INTERACTIONS.md §11 has the provenance and the way back to the package.
|
|
12
15
|
//
|
|
@@ -52,15 +55,21 @@ interface Body {
|
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
// --- filter-boolean: `.filter(Boolean)` removes falsy members from the element type ---
|
|
55
|
-
// NoInfer
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
+
// NoInfer stops contextual typing from flowing backward into S when .filter(Boolean) is used inline as a function
|
|
59
|
+
// argument, which would silently skip structural checks on array elements (ts-reset#233). The <S extends T> generic
|
|
60
|
+
// keeps overload resolution correct so non-Boolean predicates on union arrays fall through to the built-in.
|
|
61
|
+
//
|
|
62
|
+
// DEVIATION from upstream 0.7.0, which returns `TSReset.NonFalsy<NoInfer<S>>[]`: TS keeps the NoInfer wrapper on object
|
|
63
|
+
// types, so NonFalsy never distributes over it — `(Obj | null)[]` stayed `NoInfer<Obj | null>[]`, and correct inline
|
|
64
|
+
// calls and generic `(U | null)[]` were rejected (only primitive unions narrowed). Wrapping the whole result keeps the
|
|
65
|
+
// #233 inference block and lets NonFalsy resolve; the only visible difference is hovers reading `NoInfer<Obj>[]`.
|
|
66
|
+
// tests/reset.types.ts covers both. Upstream has no issue filed for this as of 2026-11-11.
|
|
58
67
|
interface Array<T> {
|
|
59
|
-
filter<S extends T>(predicate: BooleanConstructor, thisArg?: any): TSReset.NonFalsy<
|
|
68
|
+
filter<S extends T>(predicate: BooleanConstructor, thisArg?: any): NoInfer<TSReset.NonFalsy<S>>[]
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
interface ReadonlyArray<T> {
|
|
63
|
-
filter<S extends T>(predicate: BooleanConstructor, thisArg?: any): TSReset.NonFalsy<
|
|
72
|
+
filter<S extends T>(predicate: BooleanConstructor, thisArg?: any): NoInfer<TSReset.NonFalsy<S>>[]
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
// --- is-array: `Array.isArray` narrows to unknown[] instead of any[] ---
|