Skip to content

Commit

Permalink
BREAKING(fs): disallow new Deno.FsFile() (#25478)
Browse files Browse the repository at this point in the history
Towards #22079
  • Loading branch information
iuioiua authored Sep 6, 2024
1 parent d8f3123 commit dcf1555
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
10 changes: 0 additions & 10 deletions cli/tsc/dts/lib.deno.ns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2056,16 +2056,6 @@ declare namespace Deno {
* ```
*/
readonly writable: WritableStream<Uint8Array>;
/**
* The constructor which takes a resource ID. Generally `FsFile` should
* not be constructed directly. Instead use {@linkcode Deno.open} or
* {@linkcode Deno.openSync} to create a new instance of `FsFile`.
*
* @deprecated This will be removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*/
constructor(rid: number);
/** Write the contents of the array buffer (`p`) to the file.
*
* Resolves to the number of bytes written.
Expand Down
11 changes: 2 additions & 9 deletions ext/fs/30_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,16 +590,9 @@ class FsFile {
});
this.#rid = rid;
if (!symbol || symbol !== SymbolFor("Deno.internal.FsFile")) {
internals.warnOnDeprecatedApi(
"new Deno.FsFile()",
new Error().stack,
"Use `Deno.open` or `Deno.openSync` instead.",
throw new TypeError(
"`Deno.FsFile` cannot be constructed, use `Deno.open()` or `Deno.openSync()` instead.",
);
if (internals.future) {
throw new TypeError(
"`Deno.FsFile` cannot be constructed, use `Deno.open()` or `Deno.openSync()` instead.",
);
}
}
}

Expand Down

0 comments on commit dcf1555

Please sign in to comment.