feat(types): enable tsconfig strict mode#2
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1. Turns on TypeScript
"strict": trueintsconfig.json(and therefore also intsconfig.es6.json, which extends it). Only 8 errors surfaced across the whole codebase, allstrictPropertyInitialization:src/faceExpressionNet/FaceExpressions.ts: initialize the 7 expression fields to0. They are immediately overwritten by the constructor via theRecord<FaceExpressionLabel, number>alias, so the default is never observable.src/dom/NetInput.ts: initialize_inputSizeto0(gets set duringtoBatchTensor).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-enablednoImplicitAny,noImplicitThis, etc.Review & Testing Checklist for Human
pnpm run buildsucceeds locally (it does on my VM; CI will confirm on Node 18/20/22).new FaceExpressions(probs)still returns the expected label map — the default0values should be overwritten by the constructor every time.Notes
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