8000 fix: types of _preWalkVariableDeclaration by arkapratimc · Pull Request #19299 · webpack/webpack · GitHub
[go: up one dir, main page]

Skip to content

fix: types of _preWalkVariableDeclaration #19299

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation


8000
arkapratimc
Copy link
Contributor
@arkapratimc arkapratimc commented Mar 9, 2025

What kind of change does this PR introduce?
Adds a type to the 2nd parameter of _preWalkVariableDeclaration. The hook.call function accepts a parameter of type Pattern. That's why I think Pattern would be a more suitable type than Declaration(which is the old one).

Did you add tests for your changes?
No

Does this PR introduce a breaking change?
No

What needs to be documented once your changes are merged?
No

Copy link
Member
@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Lint failed, please fix it

varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])),
/** @type {HookMap<SyncBailHook<[Declaration], boolean | void>>} */
/** @type {HookMap<SyncBailHook<[Pattern], boolean | void>>} */
Copy link
Member

Choose a reason for hiding this comment

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

  • I think using Patten is a mistake here, maybe we handle very a lot of things and should not do it in such hooks, need investigate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The hook.call function is accepting the argument of type Pattern though.

decl is actually declarator.id which is also a Pattern -> https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5958465eb0de1b1f305b8d02d343659cb34ea271/types/estree/index.d.ts#L255

Copy link
Member

Choose a reason for hiding this comment

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

I will check in future

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.

2 participants
0