1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

BREAKING(fs): disallow new Deno.FsFile() (#25478)

Towards #22079
This commit is contained in:
Asher Gomez 2024-09-06 18:28:42 +10:00 committed by GitHub
parent d8f3123c36
commit dcf155516b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 19 deletions

View file

@ -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.

View file

@ -590,18 +590,11 @@ 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.",
);
if (internals.future) {
throw new TypeError(
"`Deno.FsFile` cannot be constructed, use `Deno.open()` or `Deno.openSync()` instead.",
);
}
}
}
get rid() {
internals.warnOnDeprecatedApi(