babel / babel

🐠 Babel is a compiler for writing next generation JavaScript.
https://babel.dev
MIT License
42.96k stars 5.59k forks source link

Always pass type argument to `.startNode` #16417

Closed nicolo-ribaudo closed 1 month ago

nicolo-ribaudo commented 1 month ago
Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

I was working on unifying AST type definitions across @babel/parser and @babel/types, and noticed that in many places in @babel/parser variables are typed as N.Node (which is the AST equivalent of any). This PR fixes that.

I plan to eventually open a PR to, when possible, move the type string from finishNode to startNode so that the type can be inferred better.

babel-bot commented 1 month ago

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/56704