Skip to content

feat(types): enable tsconfig strict mode#2

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1776955000-strict-mode
Open

feat(types): enable tsconfig strict mode#2
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1776955000-strict-mode

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Summary

Follow-up to #1. Turns on TypeScript "strict": true in tsconfig.json (and therefore also in tsconfig.es6.json, which extends it). Only 8 errors surfaced across the whole codebase, all strictPropertyInitialization:

  • src/faceExpressionNet/FaceExpressions.ts: initialize the 7 expression fields to 0. They are immediately overwritten by the constructor via the Record<FaceExpressionLabel, number> alias, so the default is never observable.
  • src/dom/NetInput.ts: initialize _inputSize to 0 (gets set during toBatchTensor).

Fills the remaining slot from the original audit (4.1). After this both the commonjs and es6 builds compile under full strict mode including strictNullChecks, strictFunctionTypes, strictBindCallApply, alwaysStrict, strictPropertyInitialization, plus the previously-enabled noImplicitAny, noImplicitThis, etc.

Review & Testing Checklist for Human

  • Confirm pnpm run build succeeds locally (it does on my VM; CI will confirm on Node 18/20/22).
  • Sanity check new FaceExpressions(probs) still returns the expected label map — the default 0 values should be overwritten by the constructor every time.

Notes

  • Zero runtime behavior change expected. This is a pure type-tightening + trivial initializer change.
  • If you'd like, next steps on top of strict mode would be noUnusedLocals, noUnusedParameters, noUncheckedIndexedAccess, exactOptionalPropertyTypes — those are stricter and will likely surface more legitimate issues worth fixing. Happy to do in a follow-up.

Link to Devin session: https://app.devin.ai/sessions/6d909458cbfa410c899eef109d08dc47
Requested by: @SujalXplores

Turn on TypeScript 'strict: true' for the main config. Only 8 errors surfaced,
all strictPropertyInitialization:

- FaceExpressions: initialize the 7 expression fields to 0 (they are overwritten
  by the constructor via the Record<FaceExpressionLabel, number> alias)
- NetInput: initialize _inputSize to 0

This is already covered by the es6 tsconfig inheriting from the main one, so
both build outputs are now strict-checked.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
modern-face-api Error Error Apr 23, 2026 2:24pm

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.

0 participants