Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sosoba
Copy link
Contributor

@sosoba sosoba commented May 16, 2023

Please fill in this template.

If changing an existing definition:

@typescript-bot
Copy link
Contributor

typescript-bot commented May 16, 2023

@sosoba Thank you for submitting this PR!

This is a live comment which 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
  • ✅ Only a DT maintainer can approve changes without tests

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": 65505,
  "author": "sosoba",
  "headCommitOid": "4ab7de1a7a4446009929c06c038857dadb1beb45",
  "mergeBaseOid": "d9244492f8e3e1cf1560185d8c02b4a75a18633b",
  "lastPushDate": "2023-05-18T05:46:56.000Z",
  "lastActivityDate": "2023-05-26T20:10:56.000Z",
  "mergeOfferDate": "2023-05-25T18:00:42.000Z",
  "mergeRequestDate": "2023-05-26T20:10:56.000Z",
  "mergeRequestUser": "Semigradsky",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "node",
      "kind": "edit",
      "files": [
        {
          "path": "types/node/fs.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/fs/promises.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/ts4.8/fs.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/ts4.8/fs/promises.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v16/fs.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v16/fs/promises.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v16/ts4.8/fs.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v16/ts4.8/fs/promises.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v18/fs.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v18/fs/promises.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v18/ts4.8/fs.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v18/ts4.8/fs/promises.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "Microsoft",
        "DefinitelyTyped",
        "jkomyno",
        "alvis",
        "r3nya",
        "btoueg",
        "smac89",
        "touffy",
        "DeividasBakanas",
        "eyqs",
        "Hannes-Magnusson-CK",
        "hoo29",
        "kjin",
        "ajafff",
        "islishude",
        "mwiktorczyk",
        "mohsen1",
        "n-e",
        "galkin",
        "parambirs",
        "eps1lon",
        "SimonSchick",
        "ThomasdenH",
        "WilcoBakker",
        "wwwy3y3",
        "samuela",
        "kuehlein",
        "bhongy",
        "chyzwar",
        "trivikr",
        "yoursunny",
        "qwelias",
        "ExE-Boss",
        "peterblazejewicz",
        "addaleax",
        "victorperin",
        "ZYSzys",
        "NodeJS",
        "LinusU",
        "wafuwafu13",
        "mcollina",
        "Semigradsky"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "mcollina",
      "date": "2023-05-26T14:42:32.000Z",
      "isMaintainer": false
    },
    {
      "type": "approved",
      "reviewer": "jakebailey",
      "date": "2023-05-25T17:59:59.000Z",
      "isMaintainer": true
    },
    {
      "type": "approved",
      "reviewer": "Semigradsky",
      "date": "2023-05-18T08:18:03.000Z",
      "isMaintainer": false
    }
  ],
  "mainBotCommentID": 1548940598,
  "ciResult": "pass"
}

@typescript-bot typescript-bot added Critical package Untested Change This PR does not touch tests labels May 16, 2023
@typescript-bot
Copy link
Contributor

Hey @sosoba,

😒 Your PR doesn't modify any tests, so it's hard to know what's being fixed, and your changes might regress in the future. Please consider adding tests to cover the change you're making. Including tests allows this PR to be merged by yourself and the owners of this module.

This can potentially save days of time for you!

@typescript-bot
Copy link
Contributor

@Semigradsky
Copy link
Contributor

@sosoda It looks like filename in FileChangeInfo (node:fs/promises module) can be null too?

All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`
@sosoba
Copy link
Contributor Author

sosoba commented May 16, 2023

@sosoda It looks like filename in FileChangeInfo (node:fs/promises module) can be null too?

You have right!. Doc says:

All the caveats for fs.watch() also apply to fsPromises.watch()

I added a second change.

@Semigradsky
Copy link
Contributor

Related: nodejs/node#48032

@peterblazejewicz
Copy link
Member

what's the outcome here? Do we need TS4.8 update and ship?

@Semigradsky
Copy link
Contributor

Sure! @sosoba please, add these changes also to another applicable node versions (v14, v16, v18 folders) and to TypeScript<4.8 versions (ts4.8 folders).

Copy link
Contributor

@Semigradsky Semigradsky left a comment

Choose a reason for hiding this comment

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

👍

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label May 18, 2023
@jakebailey
Copy link
Member

I feel like I'm missing something in the docs; the link provided in the PR description doesn't seem to go anywhere. Everything I'm reading seems to imply that this filename is not nullable: https://nodejs.org/dist/latest-v18.x/docs/api/fs.html#event-change

@jakebailey
Copy link
Member

Ugh, it was my browser. This section appears in the fs.watch block:

Providing filename argument in the callback is only supported on Linux, macOS, Windows, and AIX. Even on supported platforms, filename is not always guaranteed to be provided. Therefore, don't assume that filename argument is always provided in the callback, and have some fallback logic if it is null.

This is going to be pretty breaky :\

@jakebailey
Copy link
Member

I know that this is probably technically correct, but is it super useful if all of the major OSs definitely get a string every time?

@sosoba
Copy link
Contributor Author

sosoba commented May 19, 2023

I know that this is probably technically correct, but is it super useful if all of the major OSs definitely get a string every time?

What you mean "major OS"? I have issue with empty filename for Windows 11. This happens ex. when Node watch which files are modified by another Java process.

@jakebailey
Copy link
Member

I guess the wording doesn't preclude a "supported" OS passing null...

@typescript-bot
Copy link
Contributor

⏳ Hi @sosoba,

It's been a few days since this PR was approved by Semigradsky and we're waiting for a DT maintainer to give a review.

If you would like to short-circuit this wait, you can edit some of the test files in the package which verify how the .d.ts files work. This would allow the PR to be merged by you or the DT module owners after a re-review.

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

I guess we'll see; I know TS itself will have to fix a type error with this.

@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels May 25, 2023
@typescript-bot
Copy link
Contributor

@sosoba: Everything looks good here. I am ready to merge this PR (at 4ab7de1) 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, @DefinitelyTyped, @jkomyno, @alvis, @r3nya, @btoueg, @smac89, @Touffy, @DeividasBakanas, @eyqs, @Hannes-Magnusson-CK, @hoo29, @kjin, @ajafff, @islishude, @mwiktorczyk, @mohsen1, @n-e, @galkin, @parambirs, @eps1lon, @SimonSchick, @ThomasdenH, @WilcoBakker, @wwwy3y3, @samuela, @kuehlein, @bhongy, @chyzwar, @trivikr, @yoursunny, @qwelias, @ExE-Boss, @peterblazejewicz, @addaleax, @victorperin, @ZYSzys, @nodejs, @LinusU, @wafuwafu13, @mcollina, @Semigradsky: you can do this too.)

Copy link
Contributor

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@Semigradsky
Copy link
Contributor

Ready to merge

@typescript-bot typescript-bot merged commit 04a94ba into DefinitelyTyped:master May 26, 2023
Desplandis pushed a commit to Desplandis/DefinitelyTyped that referenced this pull request Jul 3, 2023
…event filename by @sosoba

* fix: add missing null on watch event filename

* fix: add missing null on fsPromises.watch result filename

All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`

* fix: applly fs.watch to another node versions
marmitar added a commit to marmitar/thelounge that referenced this pull request Nov 17, 2025
Fixed the type of `fs.watch`, which may pass to `null` for the callback
(DefinitelyTyped/DefinitelyTyped#65505).

Removed `WritableStream` type, since its events don't match `busboy`
anymore (DefinitelyTyped/DefinitelyTyped#68313).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical package Maintainer Approved Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner Untested Change This PR does not touch tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants