Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve type safety of DOM elements on core/dom #13735

Merged
merged 5 commits into from May 14, 2024

Conversation

mattpap
Copy link
Contributor

@mattpap mattpap commented Mar 4, 2024

Previously constructs like div({style: {margin: "10px"}, tabIndex: 0}, ...) were pretty much dynamically typed. This PR fixes that problem and fixes any discovered issues.

Copy link

codecov bot commented Mar 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.59%. Comparing base (e61219b) to head (721670e).
Report is 37 commits behind head on branch-3.5.

❗ Current head 721670e differs from pull request most recent head 00dda62. Consider uploading reports for the commit 00dda62 to get more accurate results

Additional details and impacted files
@@              Coverage Diff               @@
##           branch-3.5   #13735      +/-   ##
==============================================
+ Coverage       91.57%   92.59%   +1.01%     
==============================================
  Files             326      325       -1     
  Lines           20737    20729       -8     
==============================================
+ Hits            18990    19194     +204     
+ Misses           1747     1535     -212     

@mattpap mattpap changed the title Improve type safety of DOM elements on core/dom. Improve type safety of DOM elements on core/dom Mar 12, 2024
@mattpap mattpap changed the base branch from branch-3.4 to branch-3.5 March 14, 2024 16:49
@mattpap
Copy link
Contributor Author

mattpap commented May 14, 2024

I tried to use some advanced types to extract relevant attributes from TS' dom.d.ts standard library, but that doesn't work reliably and increases type-checking times, so I opted for a curated list of supported attributes for each element that we use. Much simpler and robust, and if an attribute is missing then one can set if after construction. Anyway, this is an API for internal usage, so we can always update the list if needed.

@mattpap mattpap merged commit d08906b into branch-3.5 May 14, 2024
25 checks passed
@mattpap mattpap deleted the mattpap/element_types branch May 14, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants