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

fix: types #1195

Merged
merged 1 commit into from
May 12, 2022
Merged

fix: types #1195

merged 1 commit into from
May 12, 2022

Conversation

snitin315
Copy link
Member

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • documentation update
  • typo fix
  • metadata update

Motivation / Use-Case

Fix #1194

Breaking Changes

None

Additional Info

No

@codecov
Copy link

codecov bot commented Feb 6, 2022

Codecov Report

Merging #1195 (228919b) into master (b4fb714) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1195   +/-   ##
=======================================
  Coverage   97.48%   97.48%           
=======================================
  Files           9        9           
  Lines         398      398           
  Branches      123      123           
=======================================
  Hits          388      388           
  Misses          9        9           
  Partials        1        1           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4fb714...228919b. Read the comment docs.

package.json Outdated
@@ -47,6 +47,7 @@
"webpack": "^4.0.0 || ^5.0.0"
},
"dependencies": {
"@types/node": "^12.20.43",
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 we should avoid it, because it can be problem in future, ideally I think we can just copy statSync declaration in our types with todo comment

Choose a reason for hiding this comment

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

  1. probably it will not be that simple because dev-middleware implicitly imports from @types/node several other very complex types like import("http").IncomingMessage. Other examples: import("http").ServerResponse or typeof import("fs").readFileSync.
  2. seems dependency should go to devDependencies and should allow newer major versions as well

would be great to move forward this PR because it blocks TS users from updating

Copy link
Member

Choose a reason for hiding this comment

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

Why not update @types/node locally?

Choose a reason for hiding this comment

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

it will be breaking change and will require minimal supported node version to be 16 for webpack-dev-middleware.
you can't safely use node@16 typings with node@12 codebase because it includes interface and feature changes from v16.

primary issue remains: webpack-dev-middleware does not list dependency it actually uses: @types/[email protected]

Copy link
Member

Choose a reason for hiding this comment

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

Let's revisit this review @alexander-akait. What are we proposing as the better alternative solution here. If types are autogenerated it doesn't make sense to patch the statSync declaration.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we add it as devDependency here in webpack-dev-middleware or webpack-dev-server?

Choose a reason for hiding this comment

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

@snitin315 - here, in the webpack-dev-middleware package.

Choose a reason for hiding this comment

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

Oh looks like I mistyped earlier - yeah I meant webpack-dev-middleware, not webpack-dev-server

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for the contributions here 💯

@alexander-akait alexander-akait merged commit d68ab36 into master May 12, 2022
@alexander-akait alexander-akait deleted the fix-node-types branch May 12, 2022 12:43
@alexander-akait
Copy link
Member

We have a blocker #1260, hope we get patch in near future and I will do release

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.

webpack-dev-middleware/types/index.d.ts requires @types/node@16 when Node.js 12 is still LTS
5 participants