Skip to content

Enable five cheap strict compiler flags - #525

Merged
jtklein merged 1 commit into
AntonelliLab:masterfrom
jtklein-agents:384-enable-five-cheap-strict-compiler-flags
Nov 26, 2026
Merged

jtklein merged 1 commit into
AntonelliLab:masterfrom
jtklein-agents:384-enable-five-cheap-strict-compiler-flags

Conversation

@jtklein-agents

Copy link
Copy Markdown
Contributor

Summary

Turns on five stricter TypeScript checks and fixes the 14 errors they report. Tracks jtklein-agents#384.

 tsconfig.json
   "strict": false,
   "noImplicitAny": true,
+  "noImplicitThis": true,
+  "noImplicitReturns": true,
+  "noUnusedLocals": true,
+  "noUnusedParameters": true,
+  "strictBindCallApply": true,

Only one fix changes runtime code: writeAlignment in src/common/io.ts, which writes the FASTA alignment.

-const write = util.promisify( writeStream.write );
-await write.call( writeStream, chunk );
-await end.call( writeStream );
+const write = util.promisify( ( chunk, cb ) => writeStream.write( chunk, cb ) );
+await write( chunk );
+await end();

The other fixes are type-only:

  • 8 unused import React lines removed (jsx: react-jsx doesn't need them).
  • FinalAlignment.taxons spreads the arrays into union/intersection instead of calling .apply.
  • readalGetFormat returns undefined explicitly.
  • _event in the Tabs onChange handler.
  • A type annotation on a test stub's this.

Evidence

  • Before: tsc --noEmit with the five flags on master: 14 errors.
    After: yarn typecheck: 0 errors. yarn lint passes, and yarn test passes 485 of 485.
  • writeAlignment had no test. This PR adds one:
writeAlignment(tmp/out.fas, [a: ACGT, b: TTGA])
expect file == ">a\nACGT\n>b\nTTGA"   # passes

Merge Danger

Door: two-way

Reverting the commit undoes it. Nothing is persisted or migrated.

Blast Radius: small

writeAlignment is the only runtime change, and the new test pins its output. From now on, yarn typecheck fails on unused locals or parameters, so later PRs must keep those clean.

🤖 Generated with Claude Code

Turn on noImplicitThis, noImplicitReturns, noUnusedLocals,
noUnusedParameters and strictBindCallApply, and fix the 14 errors they
report. writeAlignment now promisifies bound write/end wrappers instead
of calling the promisified prototype methods with .call; a new test
covers its output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jtklein
jtklein merged commit b33cbb5 into AntonelliLab:master Nov 26, 2026
5 of 6 checks passed
@jtklein-agents
jtklein-agents deleted the 384-enable-five-cheap-strict-compiler-flags branch November 26, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants