Skip to content

fix(types): mark IDocsEntity.mention and mention_count optional#875

Merged
thostetler merged 1 commit into
adsabs:masterfrom
thostetler:fix/idocsentity-mention-optional
May 29, 2026
Merged

fix(types): mark IDocsEntity.mention and mention_count optional#875
thostetler merged 1 commit into
adsabs:masterfrom
thostetler:fix/idocsentity-mention-optional

Conversation

@thostetler
Copy link
Copy Markdown
Member

@thostetler thostetler commented May 28, 2026

Fix some eslint issues

  • mention: string[] -> mention?: string[]
  • mention_count: number -> mention_count?: number

Both fields were added without optional markers while every adjacent
field on IDocsEntity is optional. Solr responses do not guarantee these
fields, and the two existing consumers in AbstractSideNav already use
optional chaining and falsy guards on doc.mention. Aligning the type
with how the data is actually used clears 21 TS2739 errors across test
fixtures and mocks (plus 13 cascading typecheck errors).
@thostetler thostetler force-pushed the fix/idocsentity-mention-optional branch from cc6fb93 to 17993da Compare May 28, 2026 16:42
@thostetler thostetler marked this pull request as ready for review May 28, 2026 16:43
@thostetler thostetler requested review from Copilot and shinyichen May 28, 2026 16:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Risk summary: Low risk. This change only loosens TypeScript types for two fields on IDocsEntity, aligning the model with existing optional-guarded usage patterns and likely API behavior (fields may be omitted).

Changes:

  • Make IDocsEntity.mention optional (mention?: string[]).
  • Make IDocsEntity.mention_count optional (mention_count?: number).

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.6%. Comparing base (16840c8) to head (17993da).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #875     +/-   ##
========================================
- Coverage    62.6%   62.6%   -0.0%     
========================================
  Files         324     324             
  Lines       38203   38203             
  Branches     1733    1732      -1     
========================================
- Hits        23903   23900      -3     
- Misses      14259   14262      +3     
  Partials       41      41             
Files with missing lines Coverage Δ
src/api/search/types.ts 100.0% <100.0%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thostetler thostetler merged commit e24aeb0 into adsabs:master May 29, 2026
5 checks passed
@thostetler thostetler deleted the fix/idocsentity-mention-optional branch May 29, 2026 17: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.

3 participants