Skip to content

Commit 033a043

Browse files
committedJan 13, 2025·
chore: more strict type checks
1 parent c94e04a commit 033a043

File tree

7 files changed

+21
-15
lines changed

7 files changed

+21
-15
lines changed
 

‎.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
cache: "pnpm"
2121
- run: pnpm install
2222
- run: pnpm lint
23-
- run: pnpm typecheck
23+
- run: pnpm test:types
2424
- run: pnpm build
2525
- run: pnpm vitest --coverage
2626
- uses: codecov/codecov-action@v5

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"prepack": "unbuild",
2828
"release": "pnpm test && changelogen --release --push && pnpm publish",
2929
"benchmark": "node benchmark/object-hash.mjs",
30-
"test": "pnpm lint && vitest run && pnpm typecheck",
31-
"typecheck": "tsc --noEmit"
30+
"test": "pnpm lint && vitest run && pnpm test:types",
31+
"test:types": "tsc --noEmit"
3232
},
3333
"devDependencies": {
3434
"@types/node": "^22.10.5",

‎src/crypto/sha256.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ export class SHA256 extends Hasher {
3535
/**
3636
* Resets the internal state of the hash object to initial values.
3737
*/
38-
reset() {
38+
override reset() {
3939
super.reset();
4040
this._hash = new WordArray([...H]);
4141
}
4242

43-
_doProcessBlock(M: number[], offset: number) {
43+
override _doProcessBlock(M: number[], offset: number) {
4444
// Shortcut
4545
const H = this._hash.words;
4646

@@ -116,7 +116,7 @@ export class SHA256 extends Hasher {
116116
* @param {string} messageUpdate - Additional message content to include in the hash.
117117
* @returns {WordArray} The finalised hash as a WordArray.
118118
*/
119-
finalize(messageUpdate: string): WordArray {
119+
override finalize(messageUpdate: string): WordArray {
120120
super.finalize(messageUpdate);
121121

122122
const nBitsTotal = this._nDataBytes * 8;

‎src/hash/hash.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { objectHash, HashOptions } from "./object-hash";
1+
import { objectHash, type HashOptions } from "./object-hash";
22
import { sha256base64 } from "../crypto/sha256";
33

44
/**

‎src/utils/diff.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { objectHash, HashOptions } from "../hash/object-hash";
1+
import { objectHash, type HashOptions } from "../hash/object-hash";
22

33
/**
44
* Calculates the difference between two objects and returns a list of differences.

‎src/utils/is-equal.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { objectHash, HashOptions } from "../hash/object-hash";
1+
import { objectHash, type HashOptions } from "../hash/object-hash";
22
/**
33
* Compare two objects using reference equality and stable deep hashing.
44
* @param {any} object1 First object

‎tsconfig.json

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
{
22
"compilerOptions": {
33
"target": "ESNext",
4-
"module": "ESNext",
5-
"moduleResolution": "Node",
4+
"module": "preserve",
5+
"moduleDetection": "force",
66
"esModuleInterop": true,
7-
"types": ["node"],
8-
"strict": true
9-
},
10-
"include": ["src"]
7+
"allowSyntheticDefaultImports": true,
8+
"allowJs": true,
9+
"resolveJsonModule": true,
10+
"strict": true,
11+
"isolatedModules": true,
12+
"verbatimModuleSyntax": true,
13+
"forceConsistentCasingInFileNames": true,
14+
"noImplicitOverride": true,
15+
"noEmit": true
16+
}
1117
}

0 commit comments

Comments
 (0)