Skip to content

[webpack-env] make __WebpackModuleApi.Module compatible with NodeJS.Module - #47516

Merged
sandersn merged 3 commits into
DefinitelyTyped:masterfrom
jamescdavis:fix_webpack-env
Sep 17, 2020
Merged

sandersn merged 3 commits into
DefinitelyTyped:masterfrom
jamescdavis:fix_webpack-env

Conversation

@jamescdavis

@jamescdavis jamescdavis commented Sep 11, 2020

Copy link
Copy Markdown
Contributor

A recent update to node types made __WebpackModuleApi.Module incompatible with NodeJS.Module. Importing the node types in the test reveals this issue and ensures compatibility.

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: [node] Update some apis #47485
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the header.
  • Include tests for your changes
  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }. If for reason the any rule need to be disabled, disable it for that line using // tslint:disable-next-line [ruleName] and not for whole package so that the need for disabling can be reviewed.

@typescript-bot typescript-bot added Critical package Untested Change This PR does not touch tests labels Sep 11, 2020
@typescript-bot

typescript-bot commented Sep 11, 2020

Copy link
Copy Markdown
Contributor

@jamescdavis Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ❌ Most recent commit is approved by type definition owners or DT maintainers

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 47516,
  "author": "jamescdavis",
  "owners": [
    "use-strict",
    "rhonsby"
  ],
  "dangerLevel": "ScopedAndTested",
  "headCommitAbbrOid": "31ed0f6",
  "headCommitOid": "31ed0f66bdb26883f319f61ab65f16b5db948acf",
  "mergeIsRequested": false,
  "stalenessInDays": 0,
  "lastPushDate": "2020-09-12T16:40:37.000Z",
  "lastCommentDate": "2020-09-17T14:50:24.000Z",
  "maintainerBlessed": true,
  "reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/47516/files",
  "hasMergeConflict": false,
  "authorIsOwner": false,
  "isFirstContribution": false,
  "popularityLevel": "Critical",
  "newPackages": [],
  "packages": [
    "webpack-env"
  ],
  "files": [
    {
      "path": "types/webpack-env/index.d.ts",
      "kind": "definition",
      "package": "webpack-env"
    },
    {
      "path": "types/webpack-env/webpack-env-tests.ts",
      "kind": "test",
      "package": "webpack-env"
    }
  ],
  "hasDismissedReview": false,
  "ciResult": "pass",
  "lastReviewDate": "2020-09-12T17:04:49.000Z",
  "reviewersWithStaleReviews": [],
  "approvalFlags": 1,
  "isChangesRequested": false
}

@typescript-bot

Copy link
Copy Markdown
Contributor

🔔 @use-strict @rhonsby — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot

Copy link
Copy Markdown
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

Comparison details 📊
master #47516 diff
Batch compilation
Memory usage (MiB) 33.7 33.6 -0.3%
Type count 2257 2257 0%
Assignability cache size 114 114 0%
Language service
Samples taken 119 119 0%
Identifiers in tests 119 119 0%
getCompletionsAtPosition
    Mean duration (ms) 79.7 78.4 -1.7%
    Mean CV 20.7% 20.9%
    Worst duration (ms) 120.9 101.0 -16.4%
    Worst identifier hot err
getQuickInfoAtPosition
    Mean duration (ms) 78.4 79.3 +1.3%
    Mean CV 18.6% 21.5% +15.8%
    Worst duration (ms) 105.4 101.3 -3.9%
    Worst identifier ensure outdatedModules

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added the Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. label Sep 11, 2020
@typescript-bot typescript-bot removed the Untested Change This PR does not touch tests label Sep 11, 2020
@typescript-bot

Copy link
Copy Markdown
Contributor

Updated numbers for you here from b0875df.

Comparison details 📊
master #47516 diff
Batch compilation
Memory usage (MiB) 33.5 66.7 +99.2%
Type count 2257 9080 +302%
Assignability cache size 114 1628 +1328% 🚨
Language service
Samples taken 119 119 0%
Identifiers in tests 119 119 0%
getCompletionsAtPosition
    Mean duration (ms) 80.0 352.7 +341.0% 🚨
    Mean CV 20.7% 10.1%
    Worst duration (ms) 108.7 421.1 +287.3% 🚨
    Worst identifier hot Error
getQuickInfoAtPosition
    Mean duration (ms) 80.5 348.3 +332.4% 🚨
    Mean CV 21.1% 9.4% -55.6%
    Worst duration (ms) 111.8 428.9 +283.7% 🚨
    Worst identifier disposeHandler e

It looks like there are several metrics that changed quite a bit. You might want to take a look and make sure your changes won’t cause slow-downs for users consuming these types.

@typescript-bot typescript-bot added Perf: Worse typescript-bot determined that this PR has a negative impact on compilation performance. and removed Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. labels Sep 11, 2020
filename: string;
loaded: boolean;
parent: NodeModule | null;
parent: NodeModule | null | undefined;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I could have used

Suggested change
parent: NodeModule | null | undefined;
parent?: NodeModule | null;

of course, but I was going for exact parity with the node types:

parent: Module | null | undefined;

@jamescdavis

jamescdavis commented Sep 11, 2020

Copy link
Copy Markdown
Contributor Author

I'm assuming the perf change is only due to the import of the node types in the test.

Comment thread types/webpack-env/webpack-env-tests.ts Outdated
Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
@typescript-bot

Copy link
Copy Markdown
Contributor

@ExE-Boss Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot

Copy link
Copy Markdown
Contributor

Updated numbers for you here from dbb655b.

Comparison details 📊
master #47516 diff
Batch compilation
Memory usage (MiB) 33.5 63.6 +90.1%
Type count 2257 9080 +302%
Assignability cache size 114 1628 +1328% 🚨
Language service
Samples taken 119 119 0%
Identifiers in tests 119 119 0%
getCompletionsAtPosition
    Mean duration (ms) 78.1 334.3 +327.9% 🚨
    Mean CV 21.3% 10.8%
    Worst duration (ms) 105.4 403.5 +282.9% 🚨
    Worst identifier hot hot
getQuickInfoAtPosition
    Mean duration (ms) 77.0 331.2 +330.1% 🚨
    Mean CV 20.5% 9.4% -54.1%
    Worst duration (ms) 99.5 400.7 +302.6% 🚨
    Worst identifier disposeHandler status

It looks like there are several metrics that changed quite a bit. You might want to take a look and make sure your changes won’t cause slow-downs for users consuming these types.

@typescript-bot typescript-bot added the Other Approved This PR was reviewed and signed-off by a community member. label Sep 12, 2020
proton-ci pushed a commit to ProtonMail/proton-shared that referenced this pull request Sep 14, 2020
@dep

dep commented Sep 14, 2020

Copy link
Copy Markdown

How can I get these @typescript-bot magical updates in my own project?

@ExE-Boss

Copy link
Copy Markdown
Contributor

@dep-dt Ask in https://github.com/DefinitelyTyped/dt-mergebot

@jamescdavis

Copy link
Copy Markdown
Contributor Author

@use-strict @rhonsby looks like DT maintainers would like you to review. 🙏

@ExE-Boss

Copy link
Copy Markdown
Contributor

This fixes issue #47602 and closes PR #47607, so this should be placed in the PR description:

- Fixes <https://github.com/DefinitelyTyped/DefinitelyTyped/issues/47602>
- Closes <https://github.com/DefinitelyTyped/DefinitelyTyped/pull/47607>

@ulrikstrid

Copy link
Copy Markdown
Contributor

Is it possible to use this without a release to npm?

@olyop

olyop commented Sep 16, 2020

Copy link
Copy Markdown
Contributor

Is it possible to use this without a release to npm?

Since its just a typescript issue, you can manually edit file and add the undefined option in the node_modules folder.

@ulrikstrid

Copy link
Copy Markdown
Contributor

@olyop Not really feasible in CI 😂 hopefully this lands soon, or is there some workaround I can do with a flag in tsconfig.json?

@andrevmatos

Copy link
Copy Markdown
Contributor

@ulrikstrid pin @types/node@14.10.0 devDependency until this gets merged. The offending change was published as 14.10.1.

@mmso

mmso commented Sep 17, 2020

Copy link
Copy Markdown

Will this still get merged in case a maintainer review never happens?

@jamescdavis

Copy link
Copy Markdown
Contributor Author

Will this still get merged in case a maintainer review never happens?

@sandersn?

@sandersn
sandersn merged commit 3dc75e3 into DefinitelyTyped:master Sep 17, 2020
@jamescdavis
jamescdavis deleted the fix_webpack-env branch September 17, 2020 18:54
@jamescdavis

Copy link
Copy Markdown
Contributor Author

❤️ @sandersn

@jamescdavis

Copy link
Copy Markdown
Contributor Author

This was released as @types/webpack-env@1.15.3.

danielrearden pushed a commit to danielrearden/DefinitelyTyped that referenced this pull request Sep 22, 2020
…odule (DefinitelyTyped#47516)

* fix: make __WebpackModuleApi.Module compatible with NodeJS.Module

* test: import node types in test

* test: use reference instead of import

Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>

Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical package Other Approved This PR was reviewed and signed-off by a community member. Perf: Worse typescript-bot determined that this PR has a negative impact on compilation performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[@types/node] error TS2430: Interface 'NodeJS.Module' incorrectly extends interface '__WebpackModuleApi.Module'.

9 participants