skyltmax_config 3.0.1 → 4.0.0

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.
data/reset.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- // `/dom` is the whole `recommended` set (filter-boolean, json-parse, is-array, includes/has/indexOf, promise-catch,
2
- // map-constructor) plus the Storage overrides — importing any of those entrypoints separately is a no-op.
3
- import "@total-typescript/ts-reset/dom"
1
+ // Vendored ts-reset (the `/dom` set minus groupBy and promise-catch; see the header of ts-reset.d.ts). A path reference,
2
+ // not an import, because it bypasses module resolution: under a consumer's `nodenext`, `import "./ts-reset"` resolves
3
+ // to nothing without an error (this file is a library .d.ts), silently dropping every override.
4
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference
5
+ /// <reference path="./ts-reset.d.ts" />
4
6
 
5
7
  import "react"
6
8
 
@@ -39,7 +39,7 @@ const EXPECTED_ESLINT_PLUGINS = [
39
39
  "@typescript-eslint",
40
40
  "import",
41
41
  "jest-dom",
42
- "jsx-a11y",
42
+ "jsx-a11y-x",
43
43
  "prettier",
44
44
  "react-hooks",
45
45
  "testing-library",
@@ -0,0 +1,60 @@
1
+ // Type-level checks for the vendored ts-reset in ts-reset.d.ts, loaded through reset.d.ts by tsconfig.json's `types`.
2
+ // Nothing here runs: `pnpm typecheck` is the test, and a failing assertion is a compile error. Each line documents a
3
+ // behaviour consumers of `@signmax/config/reset.d.ts` rely on, including the two entrypoints deliberately left out.
4
+
5
+ type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false
6
+ type Expect<T extends true> = T
7
+
8
+ declare const values: (string | number | null | undefined | 0 | "")[]
9
+ declare const response: Response
10
+ declare const literals: readonly ("a" | "b")[]
11
+ declare const widened: string
12
+ declare const anything: unknown
13
+ declare const union: Promise<string> | Promise<number>
14
+ declare const element: HTMLDivElement
15
+
16
+ const _filtered = values.filter(Boolean)
17
+ const _parsed = JSON.parse("{}")
18
+ const _json = response.json()
19
+ const _map = new Map()
20
+ const _stored = localStorage.token
21
+ const _cloned = element.cloneNode(true)
22
+
23
+ export type Checks = [
24
+ // filter-boolean
25
+ Expect<Equal<typeof _filtered, (string | number)[]>>,
26
+ // json-parse, fetch
27
+ Expect<Equal<typeof _parsed, unknown>>,
28
+ Expect<Equal<typeof _json, Promise<unknown>>>,
29
+ // map-constructor
30
+ Expect<Equal<typeof _map, Map<unknown, unknown>>>,
31
+ // storage
32
+ Expect<Equal<typeof _stored, unknown>>,
33
+ // clone-node
34
+ Expect<Equal<typeof _cloned, HTMLDivElement>>,
35
+ ]
36
+
37
+ // filter-boolean inline as an argument still checks the elements (ts-reset#233; 0.6.1 let this compile)
38
+ declare function pet(animals: readonly { type: string; name: string }[]): void
39
+ // @ts-expect-error — `{ type: "dog" }` is missing `name`
40
+ pet([{ type: "cat", name: "Fluffy" }, { type: "dog" }].filter(Boolean))
41
+
42
+ // array-includes: a widened value is accepted without a cast
43
+ literals.includes(widened)
44
+
45
+ // is-array narrows to unknown[], not any[]
46
+ if (Array.isArray(anything)) {
47
+ const first: unknown = anything[0]
48
+ // @ts-expect-error — unknown is not assignable to string; under the stock lib this would be any and compile
49
+ const notAny: string = anything[0]
50
+ void [first, notAny]
51
+ }
52
+
53
+ // promise-catch is NOT vendored: `.catch` on a union of promises compiles (ts-reset#209 made it TS2349)
54
+ void union.catch(() => undefined)
55
+
56
+ // map-groupby / object-groupby are NOT vendored: the ES2022 target from typescript.json still rejects them
57
+ // @ts-expect-error — TS2550, groupBy needs lib es2024
58
+ void Map.groupBy([1], n => n)
59
+ // @ts-expect-error — TS2550, groupBy needs lib es2024
60
+ void Object.groupBy([1], n => n)
data/ts-reset.d.ts ADDED
@@ -0,0 +1,133 @@
1
+ // Vendored from @total-typescript/ts-reset (https://github.com/mattpocock/ts-reset), `src/entrypoints/` at commit
2
+ // 81b3b2614a32e47948cd4b8d5468879c07c2b361 — the unpublished 0.7.0 on `main`; npm `latest` is stuck at 0.6.1 because
3
+ // the 2026-04-01 publish failed. This is the `/dom` entrypoint (`recommended` + `storage` + `clone-node`) minus:
4
+ //
5
+ // - `map-groupby` and `object-groupby`: they declare `Map.groupBy`/`Object.groupBy` outright, so under this config's
6
+ // ES2022 lib they typecheck instead of reporting TS2550 — they would widen the target check, not just refine a type.
7
+ // - `promise-catch`, which 0.7.0 itself drops from `recommended`: its extra overload makes `.catch()`/`.then()` on a
8
+ // `Promise<A> | Promise<B>` union a hard TS2349 error (ts-reset#209).
9
+ //
10
+ // Must stay a global script (no top-level import/export): every declaration here merges into a lib interface.
11
+ // docs/upgrades/INTERACTIONS.md §11 has the provenance and the way back to the package.
12
+ //
13
+ // Copyright 2023 Matthew Pocock
14
+ //
15
+ // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
16
+ // documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
17
+ // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
18
+ // permit persons to whom the Software is furnished to do so, subject to the following conditions:
19
+ //
20
+ // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
21
+ // Software.
22
+ //
23
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24
+ // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
25
+ // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
+
28
+ /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars --
29
+ these are merges into lib interfaces: signatures mirror the lib's `any`, and type parameters (`Map<K, V>`) must match
30
+ the lib's declarations exactly, used or not. */
31
+
32
+ // --- utils ---
33
+ declare namespace TSReset {
34
+ type NonFalsy<T> = T extends false | 0 | "" | null | undefined | 0n ? never : T
35
+
36
+ type WidenLiteral<T> = T extends string
37
+ ? string
38
+ : T extends number
39
+ ? number
40
+ : T extends boolean
41
+ ? boolean
42
+ : T extends bigint
43
+ ? bigint
44
+ : T extends symbol
45
+ ? symbol
46
+ : T
47
+ }
48
+
49
+ // --- fetch: `res.json()` returns unknown instead of any ---
50
+ interface Body {
51
+ json(): Promise<unknown>
52
+ }
53
+
54
+ // --- filter-boolean: `.filter(Boolean)` removes falsy members from the element type ---
55
+ // NoInfer<S> prevents contextual typing from flowing backward through S when .filter(Boolean) is used inline as a
56
+ // function argument, which would silently skip structural checks on array elements (ts-reset#233). The <S extends T>
57
+ // generic keeps overload resolution correct so non-Boolean predicates on union arrays fall through to the built-in.
58
+ interface Array<T> {
59
+ filter<S extends T>(predicate: BooleanConstructor, thisArg?: any): TSReset.NonFalsy<NoInfer<S>>[]
60
+ }
61
+
62
+ interface ReadonlyArray<T> {
63
+ filter<S extends T>(predicate: BooleanConstructor, thisArg?: any): TSReset.NonFalsy<NoInfer<S>>[]
64
+ }
65
+
66
+ // --- is-array: `Array.isArray` narrows to unknown[] instead of any[] ---
67
+ interface ArrayConstructor {
68
+ isArray(arg: any): arg is unknown[]
69
+ }
70
+
71
+ // --- json-parse: `JSON.parse` returns unknown instead of any ---
72
+ interface JSON {
73
+ /**
74
+ * Converts a JavaScript Object Notation (JSON) string into an object.
75
+ * @param text A valid JSON string.
76
+ * @param reviver A function that transforms the results. This function is called for each member of the object.
77
+ * If a member contains nested objects, the nested objects are transformed before the parent object is.
78
+ */
79
+ parse(text: string, reviver?: (this: any, key: string, value: any) => any): unknown
80
+ }
81
+
82
+ // --- array-includes: `.includes` accepts the widened type of a literal-typed array ---
83
+ interface ReadonlyArray<T> {
84
+ includes(searchElement: T | (TSReset.WidenLiteral<T> & {}), fromIndex?: number): boolean
85
+ }
86
+
87
+ interface Array<T> {
88
+ includes(searchElement: T | (TSReset.WidenLiteral<T> & {}), fromIndex?: number): boolean
89
+ }
90
+
91
+ // --- set-has ---
92
+ interface Set<T> {
93
+ has(value: T | (TSReset.WidenLiteral<T> & {})): boolean
94
+ }
95
+
96
+ interface ReadonlySet<T> {
97
+ has(value: T | (TSReset.WidenLiteral<T> & {})): boolean
98
+ }
99
+
100
+ // --- map-constructor: `new Map()` is Map<unknown, unknown> instead of Map<any, any> ---
101
+ interface MapConstructor {
102
+ new <K = unknown, V = unknown>(): Map<K, V>
103
+ }
104
+
105
+ // --- map-has ---
106
+ interface Map<K, V> {
107
+ has(value: K | (TSReset.WidenLiteral<K> & {})): boolean
108
+ }
109
+
110
+ interface ReadonlyMap<K, V> {
111
+ has(value: K | (TSReset.WidenLiteral<K> & {})): boolean
112
+ }
113
+
114
+ // --- array-index-of ---
115
+ interface ReadonlyArray<T> {
116
+ lastIndexOf(searchElement: T | (TSReset.WidenLiteral<T> & {}), fromIndex?: number): number
117
+ indexOf(searchElement: T | (TSReset.WidenLiteral<T> & {}), fromIndex?: number): number
118
+ }
119
+
120
+ interface Array<T> {
121
+ lastIndexOf(searchElement: T | (TSReset.WidenLiteral<T> & {}), fromIndex?: number): number
122
+ indexOf(searchElement: T | (TSReset.WidenLiteral<T> & {}), fromIndex?: number): number
123
+ }
124
+
125
+ // --- storage (dom): unknown keys on `localStorage`/`sessionStorage` read as unknown instead of any ---
126
+ interface Storage {
127
+ [name: string & {}]: unknown
128
+ }
129
+
130
+ // --- clone-node (dom): `el.cloneNode()` keeps the element type instead of widening to Node ---
131
+ interface Node {
132
+ cloneNode(subtree?: boolean): this
133
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skyltmax_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Signmax AB
@@ -109,6 +109,7 @@ files:
109
109
  - fixture/pnpm-lock.yaml
110
110
  - fixture/pnpm-workspace.yaml
111
111
  - fixture/src/index.ts
112
+ - fixture/src/ui/avatar.tsx
112
113
  - fixture/src/ui/button.tsx
113
114
  - fixture/src/ui/card.tsx
114
115
  - fixture/tsconfig.json
@@ -125,6 +126,8 @@ files:
125
126
  - rubocop.yml
126
127
  - skyltmax_config.gemspec
127
128
  - tests/configs.test.js
129
+ - tests/reset.types.ts
130
+ - ts-reset.d.ts
128
131
  - tsconfig.json
129
132
  - typescript.json
130
133
  homepage: https://github.com/skyltmax/config