Visitar URL original
chore(core): ratchet strictNullChecks errors against a per-file baseline by NathanWalker · Pull Request #11511 · NativeScript/NativeScript · GitHub
Skip to content

chore(core): ratchet strictNullChecks errors against a per-file baseline - #11511

Open
NathanWalker wants to merge 1 commit into
mainfrom
chore/core-strict-null-checks
Open

NathanWalker wants to merge 1 commit into
mainfrom
chore/core-strict-null-checks

Conversation

@NathanWalker

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

@nativescript/core is type-checked without strictNullChecks, so many of its types state less than its code does (a number that is sometimes undefined, an optional parameter narrowed to required in an override). Under strictNullChecks core has 1797 errors in 176 files on main, and nothing type-checks core on pull requests.

What is the new behavior?

A ratchet so the strict error count can only go down, ahead of area-by-area, types-only fix PRs. No source changes.

  • packages/core/tsconfig.strict.json — tsconfig.lib.json with strictNullChecks, noEmit.
  • tools/scripts/strict-baseline.mjs — runs tsc on it and compares the error count per file with packages/core/strict-baseline.json (per file, so an error fixed in one file cannot hide one added in another):
    • a file whose count rises, or a new file with errors, fails and prints that file's errors;
    • a file whose count drops also fails until the baseline is lowered in the same change, so the baseline never drifts above reality;
    • --update rewrites the baseline and refuses increases.
  • core:typecheck-strict Nx target (npx nx run core:typecheck-strict [--update]). Not cached: a replayed --update would skip writing the baseline, and the check takes ~4s.
  • .github/workflows/core_typecheck.yml — runs the target on pull requests and pushes to main (Node + npm ci only, no simulators).
  • Documented in tools/notes/DevelopmentWorkflow.md and AGENTS.md.

Verified locally: clean tree passes; an added error in a clean file and in a baselined file both fail with the offending errors listed; --update refuses to record the increase; a lowered count fails until --update, which records it.

Adds packages/core/tsconfig.strict.json (tsconfig.lib.json with
strictNullChecks) and a core:typecheck-strict target that compares the
error count of each file with packages/core/strict-baseline.json. A file
may not gain errors or newly appear; a file whose count drops must lower
the baseline in the same change (--update, which refuses increases).

Baseline on main: 1797 errors in 176 files. CI runs the check on pull
requests and pushes to main.
@nx-cloud

nx-cloud Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit f427270

Command Status Duration Result
nx test apps-automated -c=android ❌ Failed 3m 29s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 Dealing with memory or CPU issues? See memory and CPU details with the resource usage add-on ↗.


☁️ Nx Cloud last updated this comment at 2026-10-07 16:40:46 UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11511
npm i https://pkg.pr.new/@nativescript/vite@11511
npm i https://pkg.pr.new/@nativescript/webpack@11511

commit: f427270

This branch has not been deployed

No deployments
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.

1 participant