File tree Expand file tree Collapse file tree 6 files changed +40
-14
lines changed
Expand file tree Collapse file tree 6 files changed +40
-14
lines changed Original file line number Diff line number Diff line change @@ -2152,19 +2152,19 @@ declare module "node:fs" {
21522152 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
21532153 */
21542154 function mkdtempSync ( prefix : string , options ?: EncodingOption ) : string | NonSharedBuffer ;
2155- interface DisposableTempDir extends AsyncDisposable {
2155+ interface DisposableTempDir extends Disposable {
21562156 /**
21572157 * The path of the created directory.
21582158 */
21592159 path : string ;
21602160 /**
21612161 * A function which removes the created directory.
21622162 */
2163- remove ( ) : Promise < void > ;
2163+ remove ( ) : void ;
21642164 /**
21652165 * The same as `remove`.
21662166 */
2167- [ Symbol . asyncDispose ] ( ) : Promise < void > ;
2167+ [ Symbol . dispose ] ( ) : void ;
21682168 }
21692169 /**
21702170 * Returns a disposable object whose `path` property holds the created directory
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ declare module "node:fs/promises" {
2020 CopyOptions ,
2121 Dir ,
2222 Dirent ,
23- DisposableTempDir ,
2423 EncodingOption ,
2524 GlobOptions ,
2625 GlobOptionsWithFileTypes ,
@@ -980,6 +979,20 @@ declare module "node:fs/promises" {
980979 prefix : string ,
981980 options ?: ObjectEncodingOptions | BufferEncoding | null ,
982981 ) : Promise < string | NonSharedBuffer > ;
982+ interface DisposableTempDir extends AsyncDisposable {
983+ /**
984+ * The path of the created directory.
985+ */
986+ path : string ;
987+ /**
988+ * A function which removes the created directory.
989+ */
990+ remove ( ) : Promise < void > ;
991+ /**
992+ * The same as `remove`.
993+ */
994+ [ Symbol . asyncDispose ] ( ) : Promise < void > ;
995+ }
983996 /**
984997 * The resulting Promise holds an async-disposable object whose `path` property
985998 * holds the created directory path. When the object is disposed, the directory
Original file line number Diff line number Diff line change @@ -238,10 +238,10 @@ async function testPromisify() {
238238 const disposable = fs . mkdtempDisposableSync ( "/tmp/foo-" ) ;
239239 // $ExpectType string
240240 disposable . path ;
241- // $ExpectType Promise< void>
241+ // $ExpectType void
242242 disposable . remove ( ) ;
243- // $ExpectType Promise< void>
244- disposable [ Symbol . asyncDispose ] ( ) ;
243+ // $ExpectType void
244+ disposable [ Symbol . dispose ] ( ) ;
245245
246246 fs . promises . mkdtempDisposable ( "/tmp/foo-" ) . then ( ( result ) => {
247247 // $ExpectType string
Original file line number Diff line number Diff line change @@ -2193,19 +2193,19 @@ declare module "fs" {
21932193 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
21942194 */
21952195 export function mkdtempSync ( prefix : string , options ?: EncodingOption ) : string | NonSharedBuffer ;
2196- export interface DisposableTempDir extends AsyncDisposable {
2196+ export interface DisposableTempDir extends Disposable {
21972197 /**
21982198 * The path of the created directory.
21992199 */
22002200 path : string ;
22012201 /**
22022202 * A function which removes the created directory.
22032203 */
2204- remove ( ) : Promise < void > ;
2204+ remove ( ) : void ;
22052205 /**
22062206 * The same as `remove`.
22072207 */
2208- [ Symbol . asyncDispose ] ( ) : Promise < void > ;
2208+ [ Symbol . dispose ] ( ) : void ;
22092209 }
22102210 /**
22112211 * Returns a disposable object whose `path` property holds the created directory
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ declare module "fs/promises" {
2121 CopyOptions ,
2222 Dir ,
2323 Dirent ,
24- DisposableTempDir ,
2524 EncodingOption ,
2625 GlobOptions ,
2726 GlobOptionsWithFileTypes ,
@@ -981,6 +980,20 @@ declare module "fs/promises" {
981980 prefix : string ,
982981 options ?: ObjectEncodingOptions | BufferEncoding | null ,
983982 ) : Promise < string | NonSharedBuffer > ;
983+ interface DisposableTempDir extends AsyncDisposable {
984+ /**
985+ * The path of the created directory.
986+ */
987+ path : string ;
988+ /**
989+ * A function which removes the created directory.
990+ */
991+ remove ( ) : Promise < void > ;
992+ /**
993+ * The same as `remove`.
994+ */
995+ [ Symbol . asyncDispose ] ( ) : Promise < void > ;
996+ }
984997 /**
985998 * The resulting Promise holds an async-disposable object whose `path` property
986999 * holds the created directory path. When the object is disposed, the directory
Original file line number Diff line number Diff line change @@ -238,10 +238,10 @@ async function testPromisify() {
238238 const disposable = fs . mkdtempDisposableSync ( "/tmp/foo-" ) ;
239239 // $ExpectType string
240240 disposable . path ;
241- // $ExpectType Promise< void>
241+ // $ExpectType void
242242 disposable . remove ( ) ;
243- // $ExpectType Promise< void>
244- disposable [ Symbol . asyncDispose ] ( ) ;
243+ // $ExpectType void
244+ disposable [ Symbol . dispose ] ( ) ;
245245
246246 fs . promises . mkdtempDisposable ( "/tmp/foo-" ) . then ( ( result ) => {
247247 // $ExpectType string
You can’t perform that action at this time.
0 commit comments