Skip to content

chore: stronger typing for xast/css-select code #2112

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

Merged
merged 1 commit into from
Apr 30, 2025

Conversation

SethFalco
Copy link
Member

Significantly improves type checking for lib/svgo/css-select-adapter.js. Before, we declared an explicit any over the options.

  • No longer declares the type of querySelector and querySelectorAll in our .d.ts file. Instead, we use a JSDoc type, and export that in our .d.ts. This achieves the same result, but we maintain the type with the implementation, leaving less risk for it to fall out of sync.
  • Deletes lib/svgo/css-select-adapter.d.ts and uses the upstream types when we define our config. (I did declare any for two functions as they were annoying to resolve, I will look at this in future. Again, I'm striving for better, not perfect.)

@SethFalco SethFalco merged commit 1b4919a into svg:main Apr 30, 2025
13 checks passed
@SethFalco SethFalco deleted the css-select branch April 30, 2025 13:41
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