Skip to content

fix(types): forbid any — enable noImplicitAny + strictNullChecks (#133)#137

Open
jishanahmed-shaikh wants to merge 2 commits intoebi-webcomponents:mainfrom
jishanahmed-shaikh:fix/issue-133-forbid-any
Open

fix(types): forbid any — enable noImplicitAny + strictNullChecks (#133)#137
jishanahmed-shaikh wants to merge 2 commits intoebi-webcomponents:mainfrom
jishanahmed-shaikh:fix/issue-133-forbid-any

Conversation

@jishanahmed-shaikh
Copy link
Copy Markdown

Summary

Closes #133

Eliminates implicit and explicit any from src/, enables strict
TypeScript defaults, and adds an ESLint rule to prevent any from
creeping back in CI.

Changes

Config

  • tsconfig.jsonnoImplicitAny: true, strictNullChecks: true
  • eslint.config.mjs@typescript-eslint/no-explicit-any: "error"

Adapters

  • Typed all untyped function parameters in feature-adapter, proteomics-adapter, structure-adapter, variation-adapter, variation-graph-adapter
  • Fixed alphafold-confidence-adapter, alphamissense-pathogenicity-adapter, alphamissense-heatmap-adapter — proper return types and null/undefined handling
  • ptm-exchange-adapter — fixed enum indexing and null confidenceScore
  • Exported StructureFeature type from structure-adapter for reuse

Tooltips

  • Typed all parameters in feature-tooltip, structure-tooltip, variation-tooltip, ptm-tooltip
  • Exported TooltipFeature type from feature-tooltip

Components

  • protvista-uniprot.ts — typed data/rawData maps, adapter dispatch, filter handlers
  • protvista-uniprot-structure.ts — fixed implicit any bindings and null/undefined strictness

Tests

  • Updated filter-config.spec.ts casts to satisfy strict types

Verification

tsc --noEmit → 0 errors vitest run → 60/60 tests pass

Notes

Done incrementally as recommended in the issue — all src/ files are
covered in this PR. The adapter dispatch map retains a single
intentional cast (documented with a comment) due to TypeScript's
function parameter contravariance on heterogeneous maps.

Copy link
Copy Markdown
Contributor

@dlrice dlrice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for this PR! There are multiple uses of unknown - do you mind tightening up the types to avoid this?

Comment thread yarn.lock
Comment thread src/__spec__/filter-config.spec.ts Outdated
…lock.json

- Revert yarn.lock (should not be modified by this task)
- Remove package-lock.json (wrong lockfile for this project)
- filter-config.spec.ts: replace 'as unknown as' casts with a
  makeVariant() helper that builds properly-typed TransformedVariant
  fixtures — no casts needed at call sites
- proteomics-adapter.ts: extend TooltipFeature instead of a loose
  Record so formatTooltip() accepts ProteomicsFeature directly
- protvista-uniprot.ts: introduce TrackPayload union type for
  data/rawData maps, replacing Record<string,unknown>; tighten
  dataAsArray cast to use TransformedVariant[]
- utils/index.ts: widen begin param to string|number to match
  TooltipFeature.begin
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.

Forbid the any type across the codebase

2 participants