8000 [@types/node] correct `LoadFnOutput.format` by boneskull · Pull Request #72581 · DefinitelyTyped/DefinitelyTyped · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@boneskull
Copy link
Contributor
@boneskull boneskull commented Apr 23, 2025

A LoadHook accepts a LoadHookContext object having a format of string | null | undefined.

LookHook implementors often want to pass this value through (example from docs, which suggests to me that a) it can be falsy, and b) it should be a looser type as established for ResolveFnOutput in #71493).

A consequence of this is that ModuleFormat is no longer referenced anywhere; it can be removed. UPDATE: This has been reverted; ModuleFormat has not been removed.


Please fill in this template.

Testing failed for me for likely unrelated reasons:

pnpm test node

> definitely-typed@0.0.3 test /Users/boneskull/projects/definitelytyped/definitelytyped
> node --enable-source-maps node_modules/@definitelytyped/dtslint/ types "node"

dtslint@0.2.0
Error: There is an entry named ts5.6, but 5.6 is not a valid TypeScript version.
    at <anonymous> (/Users/boneskull/projects/definitelytyped/definitelytyped/node_modules/.pnpm/@definitelytyped+header-parser@0.2.0/node_modules/@definitelytyped/header-parser/src/index.ts:301:13)
    at mapDefined (/Users/boneskull/projects/definitelytyped/definitelytyped/node_modules/.pnpm/@definitelytyped+utils@0.1.0/node_modules/@definitelytyped/utils/src/collections.ts:20:17)
    at getTypesVersions (/Users/boneskull/projects/definitelytyped/definitelytyped/node_modules/.pnpm/@definitelytyped+header-parser@0.2.0/node_modules/@definitelytyped/header-parser/src/index.ts:291:20)
    at runTests (/Users/boneskull/projects/definitelytyped/definitelytyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.0_typescript@5.4.0-dev.20240117/node_modules/@definitelytyped/dtslint/src/index.ts:136:41)
    at async main (/Users/boneskull/projects/definitelytyped/definitelytyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.0_typescript@5.4.0-dev.20240117/node_modules/@definitelytyped/dtslint/src/index.ts:86:5)
 ELIFECYCLE  Test failed. See above for more details.

Select one of these and delete the others:

If changing an existing definition:

@typescript-bot
Copy link
Contributor
typescript-bot commented Apr 23, 2025

@boneskull Thank you for submitting this PR!

This is a live comment that I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by a DT maintainer

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 72581,
  "author": "boneskull",
  "headCommitOid": "563d46ce7c5428ce1d5ef49362a03cba09d9a601",
  "mergeBaseOid": "56fa141477f35c3997da2e8134786ac52847fe98",
  "lastPushDate": "2025-04-23T21:44:54.000Z",
  "lastActivityDate": "2025-05-29T22:30:48.000Z",
  "mergeOfferDate": "2025-05-29T21:49:38.000Z",
  "mergeRequestDate": "2025-05-29T22:30:48.000Z",
  "mergeRequestUser": "boneskull",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "node",
      "kind": "edit",
      "files": [
        {
          "path": "types/node/module.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/test/module.ts",
          "kind": "test"
        },
        {
          "path": "types/node/v18/module.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v18/test/module.ts",
          "kind": "test"
        },
        {
          "path": "types/node/v20/module.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v20/test/module.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "Microsoft",
        "jkomyno",
        "alvis",
        "r3nya",
        "btoueg",
        "smac89",
        "touffy",
        "DeividasBakanas",
        "eyqs",
        "Hannes-Magnusson-CK",
        "hoo29",
        "kjin",
        "ajafff",
        "islishude",
        "mwiktorczyk",
        "mohsen1",
        "galkin",
        "parambirs",
        "eps1lon",
        "ThomasdenH",
        "WilcoBakker",
        "wwwy3y3",
        "samuela",
        "kuehlein",
        "bhongy",
        "chyzwar",
        "trivikr",
        "yoursunny",
        "qwelias",
        "ExE-Boss",
        "peterblazejewicz",
        "addaleax",
        "victorperin",
        "NodeJS",
        "LinusU",
        "wafuwafu13",
        "mcollina",
        "Semigradsky"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "jakebailey",
      "date": "2025-05-29T21:49:00.000Z",
      "isMaintainer": true
    },
    {
      "type": "stale",
      "reviewer": "Bashamega",
      "date": "2025-05-07T03:25:32.000Z",
      "abbrOid": "9960c49"
    },
    {
      "type": "stale",
      "reviewer": "JakobJingleheimer",
      "date": "2025-04-25T08:22:59.000Z",
      "abbrOid": "9960c49"
    },
    {
      "type": "stale",
      "reviewer": "Renegade334",
      "date": "2025-04-24T19:45:56.000Z",
      "abbrOid": "74b18d3"
    }
  ],
  "mainBotCommentID": 2825568024,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

@typescript-bot typescript-bot moved this to Waiting for Code Reviews in Pull Request Status Board Apr 23, 2025
@boneskull boneskull force-pushed the boneskull/node-module-load-hook branch from 4c98399 to 7129a6b Compare April 23, 2025 21:46
@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Apr 23, 2025
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in Pull Request Status Board Apr 23, 2025
@typescript-bot
Copy link
Contributor
typescript-bot commented Apr 23, 2025

@boneskull The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

Note: builds that are failing do not end up on the list of PRs for the DT maintainers to review.

@boneskull
Copy link
Contributor Author

The failure is unrelated. Not sure what I need to do to get eyes on this.

@Renegade334
Copy link
Contributor

cc @JakobJingleheimer – WDYR?

The failure is unrelated. Not sure what I need to do to get eyes on this.

This is an unfortunate limitation of DT – will need some upstream housekeeping before this PR is released for review.

@jakebailey jakebailey closed this Apr 23, 2025
@jakebailey jakebailey reopened this Apr 23, 2025
@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Apr 23, 2025
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in Pull Request Status Board Apr 23, 2025
@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Apr 23, 2025
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in Pull Request Status Board Apr 23, 2025
@jakebailey jakebailey closed this Apr 23, 2025
@jakebailey jakebailey reopened this Apr 23, 2025
@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Apr 23, 2025
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in Pull Request Status Board Apr 23, 2025
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in Pull Request Status Board Apr 23, 2025
@JakobJingleheimer
Copy link
Contributor
JakobJingleheimer commented Apr 24, 2025

I'm not sure I understand: format in the final result of the load chain must be ModuleFormat (so it shouldn't be deleted). IIR, an intermediary result can contain any string value.

EDIT: Ah, I see the problem. It's impossible for typescript to guard the end of the chain. So effectively, yes.

@typescript-bot typescript-bot added the Other Approved This PR was reviewed and signed-off by a community member. label Apr 24, 2025
@boneskull boneskull force-pushed the boneskull/node-module-load-hook branch from 7129a6b to 74b18d3 Compare April 24, 2025 19:39
@typescript-bot
Copy link
Contributor

@Renegade334, @JakobJingleheimer 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 typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in Pull Request Status Board Apr 24, 2025
@typescript-bot typescript-bot added the Other Approved This PR was reviewed and signed-off by a community member. label Apr 25, 2025
@typescript-bot
Copy link
Contributor

@Renegade334 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 typescript-bot added the Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. label May 5, 2025
@typescript-bot
Copy link
Contributor

@RyanCavanaugh RyanCavanaugh moved this from Needs Maintainer Review to Waiting for Code Reviews (Blessed) in Pull Request Status Board May 5, 2025
@jakebailey
Copy link
Member

Does this need to update other versions of Node or is just the latest fine?

@JakobJingleheimer
Copy link
Contributor

Other versions (all that support loaders, I believe)

@boneskull
Copy link
Contributor Author

Is anything else needed from me here?

@jakebailey
Copy link
Member

Yes, I believe this change needs to be mirrored to the versioned subdirectories.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews (Blessed) to Needs Maintainer Action in Pull Request Status Board May 12, 2025
@typescript-bot
Copy link
Contributor

A `LoadHook` accepts a `LoadHookContext` object having a `format` of `string | null | undefined`.

`LookHook` implementors often want to pass this value through ([example from docs](https://nodejs.org/api/module.html\#asynchronous-version), which suggests to me that a) it can be falsy, and b) it should be a looser type as established for `ResolveFnOutput` in DefinitelyTyped#71493).
@boneskull boneskull force-pushed the boneskull/node-module-load-hook branch from 9960c49 to 563d46c Compare May 22, 2025 21:29
@typescript-bot typescript-bot removed the Other Approved This PR was reviewed and signed-off by a community member. label May 22, 2025
@boneskull
Copy link
Contributor Author

@jakebailey I've backported the changes.

@typescript-bot
Copy link
Contributor

@Bashamega, @JakobJingleheimer, @Renegade334 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 typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner and removed Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. labels May 29, 2025
@typescript-bot typescript-bot moved this from Needs Maintainer Action to Waiting for Author to Merge in Pull Request Status Board May 29, 2025
@typescript-bot
Copy link
Contributor

@boneskull: Everything looks good here. I am ready to merge this PR (at 563d46c) on your behalf whenever you think it's ready.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@microsoft, @jkomyno, @alvis, @r3nya, @btoueg, @smac89, @Touffy, @DeividasBakanas, @eyqs, @Hannes-Magnusson-CK, @hoo29, @kjin, @ajafff, @islishude, @mwiktorczyk, @mohsen1, @galkin, @parambirs, @eps1lon, @ThomasdenH, @WilcoBakker, @wwwy3y3, @samuela, @kuehlein, @bhongy, @chyzwar, @trivikr, @yoursunny, @qwelias, @ExE-Boss, @peterblazejewicz, @addaleax, @victorperin, @nodejs, @LinusU, @wafuwafu13, @mcollina, @Semigradsky: you can do this too.)

A3DB
@boneskull
Copy link
Contributor Author

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in Pull Request Status Board May 29, 2025
@typescript-bot typescript-bot merged commit 694320f into DefinitelyTyped:master May 29, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical package Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

0