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'
