Uh oh!
There was an error while loading. Please reload this page.
doc: deprecate non-string type in fs.symlink() - #44641
Conversation
Disallows any `type` except for `'dir'`, `'file'`, `'junction'`, or `undefined` in `fs.symlink()`, `fs.symlinkSync()`, and `fsPromises.symlink()`
aduh95
left a comment
There was a problem hiding this comment.
Why not leave this validation at the FS level, or libuv? Doing it in Node.js seems weird to me, and potentially bad for forward compatibility.
aduh95
commented
Sep 15, 2022
/cc @nodejs/fs |
LiviaMedeiros
commented
Sep 15, 2022
libuv receives flags ( |
aduh95
commented
Sep 15, 2022
Oh so we don't need a deprecation, using an invalid string is already throwing. |
aduh95
commented
Sep 20, 2023
@LiviaMedeiros is #44641 (comment) correct or am I missing something? |
LiviaMedeiros
commented
Sep 20, 2023
If I remember correctly, it's true for invalid strings; but any parameter with |
aduh95
commented
Sep 20, 2023
The documentation already indicates it should be a string, I don't think we need a deprecation for that. It sounds like we can tighten up the check as a semver major directly, unless there's a massive ecosystem breakage of doing so. |
Disallows any
typeexcept for'dir','file','junction', orundefinedinfs.symlink(),fs.symlinkSync(), andfsPromises.symlink()The implementation would be unconditional validating with
validateOneOf(type, 'type', ['dir', 'file', 'junction', undefined]), i.e. throwing an error instead of defaulting to autodetection (or instead of ignoring on non-windows platforms).Refs: #42894 (comment)
Not sure if it's worth the potential breakage. On a long run, replacing it with an object parameter (for example,
{ type: 'file', force: true, relative: false }) to allow additional options might make more sense.