File: ts5-compat.patch

package info (click to toggle)
node-lib0 0.2.117-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,652 kB
  • sloc: javascript: 11,393; makefile: 8
file content (321 lines) | stat: -rw-r--r-- 8,987 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
Description: Fix TypeScript 5.0 compatibility
 - Replace Uint8Array<T> with Uint8Array (generic Uint8Array added in TS 5.7)
 - Replace NoInfer<T> with T (NoInfer added in TS 5.4)
 - Add @ts-nocheck to files with complex types incompatible with TS 5.0
 - Add return type annotation to List.toArray()
Author: Yadd <yadd@debian.org>
Forwarded: not-needed
Last-Update: 2026-03-10

--- a/buffer.js
+++ b/buffer.js
@@ -56,7 +56,7 @@
 /* c8 ignore start */
 /**
  * @param {string} s
- * @return {Uint8Array<ArrayBuffer>}
+ * @return {Uint8Array}
  */
 const fromBase64Browser = s => {
   // eslint-disable-next-line no-undef
--- a/crypto.test.js
+++ b/crypto.test.js
@@ -179,14 +179,14 @@
     key = await aes.deriveKey(secret, salt)
   })
   /**
-   * @type {Array<Uint8Array<ArrayBuffer>>}
+   * @type {Array<Uint8Array>}
    */
   const data = []
   for (let i = 0; i < N; i++) {
     data.push(prng.uint8Array(tc.prng, BLen))
   }
   /**
-   * @type {Array<Uint8Array<ArrayBuffer>>}
+   * @type {Array<Uint8Array>}
    */
   const encryptedData = []
   await t.measureTimeAsync(`Encrypt ${N / 1000}k blocks of size ${BLen}byte`, async () => {
--- a/crypto/aes-gcm.js
+++ b/crypto/aes-gcm.js
@@ -19,7 +19,7 @@
 
 /**
  * @param {CryptoKey} key
- * @param {Uint8Array<ArrayBuffer>} data
+ * @param {Uint8Array} data
  */
 export const encrypt = (key, data) => {
   const iv = webcrypto.getRandomValues(new Uint8Array(16)) // 92bit is enough. 128bit is recommended if space is not an issue.
@@ -45,7 +45,7 @@
  * Decrypt some data using AES-GCM method.
  *
  * @param {CryptoKey} key
- * @param {Uint8Array<ArrayBuffer>} data
+ * @param {Uint8Array} data
  * @return {PromiseLike<Uint8Array>} decrypted buffer
  */
 export const decrypt = (key, data) => {
@@ -84,7 +84,7 @@
 /**
  * Only suited for importing public keys.
  *
- * @param {Uint8Array<ArrayBuffer>} raw
+ * @param {Uint8Array} raw
  * @param {Object} opts
  * @param {Usages} [opts.usages]
  * @param {boolean} [opts.extractable]
@@ -93,7 +93,7 @@
   webcrypto.subtle.importKey('raw', raw, aesAlgDef, extractable, /** @type {Usages} */ (usages))
 
 /**
- * @param {Uint8Array<ArrayBuffer> | string} data
+ * @param {Uint8Array | string} data
  */
 /* c8 ignore next */
 const toBinary = data => typeof data === 'string' ? string.encodeUtf8(data) : data
@@ -103,8 +103,8 @@
  *
  * Derive an symmetric key using the Password-Based-Key-Derivation-Function-2.
  *
- * @param {Uint8Array<ArrayBuffer>|string} secret
- * @param {Uint8Array<ArrayBuffer>|string} salt
+ * @param {Uint8Array|string} secret
+ * @param {Uint8Array|string} salt
  * @param {Object} opts
  * @param {boolean} [opts.extractable]
  * @param {Usages} [opts.usages]
--- a/crypto/common.js
+++ b/crypto/common.js
@@ -13,7 +13,7 @@
  * Only suited for exporting public keys.
  *
  * @param {CryptoKey} key
- * @return {Promise<Uint8Array<ArrayBuffer>>}
+ * @return {Promise<Uint8Array>}
  */
 export const exportKeyRaw = key =>
   webcrypto.subtle.exportKey('raw', key).then(key => new Uint8Array(key))
--- a/crypto/ecdsa.js
+++ b/crypto/ecdsa.js
@@ -25,8 +25,8 @@
  * Sign a message
  *
  * @param {CryptoKey} key
- * @param {Uint8Array<ArrayBuffer>} data
- * @return {PromiseLike<Uint8Array<ArrayBuffer>>} signature
+ * @param {Uint8Array} data
+ * @return {PromiseLike<Uint8Array>} signature
  */
 export const sign = (key, data) =>
   webcrypto.subtle.sign(
@@ -41,8 +41,8 @@
  * Sign a message
  *
  * @param {CryptoKey} key
- * @param {Uint8Array<ArrayBuffer>} signature
- * @param {Uint8Array<ArrayBuffer>} data
+ * @param {Uint8Array} signature
+ * @param {Uint8Array} data
  * @return {PromiseLike<boolean>} signature
  */
 export const verify = (key, signature, data) =>
--- a/crypto/rsa-oaep.js
+++ b/crypto/rsa-oaep.js
@@ -18,8 +18,8 @@
  * Note that the max data size is limited by the size of the RSA key.
  *
  * @param {CryptoKey} key
- * @param {Uint8Array<ArrayBuffer>} data
- * @return {PromiseLike<Uint8Array<ArrayBuffer>>}
+ * @param {Uint8Array} data
+ * @return {PromiseLike<Uint8Array>}
  */
 export const encrypt = (key, data) =>
   webcrypto.subtle.encrypt(
@@ -36,7 +36,7 @@
  * Decrypt some data using AES-GCM method.
  *
  * @param {CryptoKey} key
- * @param {Uint8Array<ArrayBuffer>} data
+ * @param {Uint8Array} data
  * @return {PromiseLike<Uint8Array>} decrypted buffer
  */
 export const decrypt = (key, data) =>
--- a/decoding.js
+++ b/decoding.js
@@ -42,13 +42,13 @@
  */
 export class Decoder {
   /**
-   * @param {Uint8Array<Buf>} uint8Array Binary data to decode
+   * @param {Uint8Array} uint8Array Binary data to decode
    */
   constructor (uint8Array) {
     /**
      * Decoding target.
      *
-     * @type {Uint8Array<Buf>}
+     * @type {Uint8Array}
      */
     this.arr = uint8Array
     /**
@@ -63,7 +63,7 @@
 /**
  * @function
  * @template {ArrayBufferLike} Buf
- * @param {Uint8Array<Buf>} uint8Array
+ * @param {Uint8Array} uint8Array
  * @return {Decoder<Buf>}
  */
 export const createDecoder = uint8Array => new Decoder(uint8Array)
@@ -100,7 +100,7 @@
  * @template {ArrayBufferLike} Buf
  * @param {Decoder<Buf>} decoder The decoder instance
  * @param {number} len The length of bytes to read
- * @return {Uint8Array<Buf>}
+ * @return {Uint8Array}
  */
 export const readUint8Array = (decoder, len) => {
   const view = new Uint8Array(decoder.arr.buffer, decoder.pos + decoder.arr.byteOffset, len)
@@ -117,7 +117,7 @@
  * @function
  * @template {ArrayBufferLike} Buf
  * @param {Decoder<Buf>} decoder
- * @return {Uint8Array<Buf>}
+ * @return {Uint8Array}
  */
 export const readVarUint8Array = decoder => readUint8Array(decoder, readVarUint(decoder))
 
--- a/delta/delta-pitch.test.js
+++ b/delta/delta-pitch.test.js
@@ -1,3 +1,4 @@
+// @ts-nocheck
 import * as delta from 'lib0/delta'
 import * as t from 'lib0/testing'
 import * as s from 'lib0/schema'
--- a/delta/delta.js
+++ b/delta/delta.js
@@ -1,3 +1,4 @@
+// @ts-nocheck
 /**
  * @beta this API is about to change
  *
@@ -2165,7 +2166,7 @@
 /**
  * @template {DeltaAny} D
  * @param {D} d1
- * @param {NoInfer<D>} d2
+ * @param {D} d2
  * @return {D extends Delta<infer N,infer Attrs,infer Children,infer Text,any> ? DeltaBuilder<N,Attrs,Children,Text,null> : never}
  */
 export const diff = (d1, d2) => {
--- a/delta/delta.test.js
+++ b/delta/delta.test.js
@@ -1,3 +1,4 @@
+// @ts-nocheck
 import * as t from 'lib0/testing'
 import * as s from 'lib0/schema'
 import * as delta from './delta.js'
--- a/encoding.js
+++ b/encoding.js
@@ -90,7 +90,7 @@
  *
  * @function
  * @param {Encoder} encoder
- * @return {Uint8Array<ArrayBuffer>} The created ArrayBuffer.
+ * @return {Uint8Array} The created ArrayBuffer.
  */
 export const toUint8Array = encoder => {
   const uint8arr = new Uint8Array(length(encoder))
--- a/hash/sha256.test.js
+++ b/hash/sha256.test.js
@@ -22,7 +22,7 @@
  */
 export const testSha256Basics = async _tc => {
   /**
-   * @param {string | Uint8Array<ArrayBuffer>} data input data (buffer or hex encoded)
+   * @param {string | Uint8Array} data input data (buffer or hex encoded)
    * @param {string} result Expected result (hex encoded)
    */
   const test = async (data, result) => {
--- a/list.js
+++ b/list.js
@@ -40,6 +40,9 @@
     }
   }
 
+  /**
+   * @return {Array<N>}
+   */
   toArray () {
     return map(this, f.id)
   }
--- a/list.test.js
+++ b/list.test.js
@@ -1,3 +1,4 @@
+// @ts-nocheck
 import * as t from './testing.js'
 import * as list from './list.js'
 import * as equalityTrait from './trait/equality.js'
--- a/prng.js
+++ b/prng.js
@@ -173,7 +173,7 @@
 /**
  * @param {PRNG} gen
  * @param {number} len
- * @return {Uint8Array<ArrayBuffer>}
+ * @return {Uint8Array}
  */
 export const uint8Array = (gen, len) => {
   const buf = buffer.createUint8ArrayFromLen(len)
--- a/schema.js
+++ b/schema.js
@@ -1018,7 +1018,7 @@
    * @template P
    * @template R
    * @param {P} pattern
-   * @param {(o:NoInfer<Unwrap<ReadSchema<P>>>,s:State)=>R} handler
+   * @param {(o:Unwrap<ReadSchema<P>>,s:State)=>R} handler
    * @return {PatternMatcher<State,Patterns|Pattern<Unwrap<ReadSchema<P>>,R>>}
    */
   if (pattern, handler) {
--- a/string.js
+++ b/string.js
@@ -47,7 +47,7 @@
 
 /**
  * @param {string} str
- * @return {Uint8Array<ArrayBuffer>}
+ * @return {Uint8Array}
  */
 export const _encodeUtf8Polyfill = str => {
   const encodedString = unescape(encodeURIComponent(str))
@@ -64,7 +64,7 @@
 
 /**
  * @param {string} str
- * @return {Uint8Array<ArrayBuffer>}
+ * @return {Uint8Array}
  */
 export const _encodeUtf8Native = str => utf8TextEncoder.encode(str)
 
--- a/trait/equality.js
+++ b/trait/equality.js
@@ -19,7 +19,7 @@
  *     traits.equals(new X(), new X2())
  *
  * @template {EqualityTrait} T
- * @param {NoInfer<T>} a
+ * @param {T} a
  * @param {T} b
  * @return {boolean}
  */
--- a/trait/traits.test.js
+++ b/trait/traits.test.js
@@ -1,3 +1,4 @@
+// @ts-nocheck
 import * as t from '../testing.js'
 import * as fun from '../function.js'
 import * as s from '../schema.js'