Skip to content

Commit c49f8bc

Browse files
committed
TS: declare Uint8Array<ArrayBuffer> over generic Uint8Array (#20)
And add lint TS rule to enforce declaring `Uint8Array<ArrayBuffer>`. This change is to limit the need to downcast Uint8Array in output when using them with e.g. WebCrypto and Blobs, following an incompatible interface change between ArrayBuffer and ArrayBufferLike (enforced in TS v5.9).
1 parent fd575a3 commit c49f8bc

6 files changed

Lines changed: 183 additions & 1124 deletions

File tree

.eslintrc.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ module.exports = {
2222
'@typescript-eslint',
2323
'chai-friendly',
2424
'import',
25-
'unicorn'
25+
'unicorn',
26+
'@protontech/enforce-uint8array-arraybuffer'
2627
],
2728

2829
'settings': {
@@ -139,6 +140,7 @@ module.exports = {
139140
'@typescript-eslint/no-unused-expressions': 0,
140141
'chai-friendly/no-unused-expressions': [2, { 'allowShortCircuit': true }],
141142
'unicorn/switch-case-braces': ['error', 'avoid'],
143+
'@protontech/enforce-uint8array-arraybuffer/enforce-uint8array-arraybuffer': 'error',
142144

143145
// Custom warnings:
144146
'no-console': 1

openpgp.d.ts

Lines changed: 68 additions & 68 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)