denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.97k stars 5.23k forks source link

DisposableStack is not implemented #20821

Open sigmaSd opened 11 months ago

sigmaSd commented 11 months ago

The types are there, but it fails at runtime https://github.com/denoland/deno/blob/edeccef4990598620bf5595df6fc8c1b1b1a7f73/cli/tsc/dts/lib.esnext.disposable.d.ts#L53

jsejcksn commented 7 months ago

Also for AsyncDisposableStack.

@lucacasonato Shouldn't situations like this — where compiling (type-checking) succeeds, but the compiled JavaScript result fails at runtime — be labelled as https://github.com/denoland/deno/labels/bug?

NfNitLoop commented 6 months ago

This bug is still present in Deno v1.40.5.

And I agree, this seems like a bug. The VSCode extension and deno check don't give any error about using DisposableStack even though it's not implemented and not even a valid identifier in scope.

lambdalisue commented 6 months ago

Just fyi. I'm using the following polyfill and it seems working OK. (thanks to https://deno.land/x/dispose)

import {
  AsyncDisposableStack,
  DisposableStack,
} from "https://deno.land/x/dispose@1.0.1/mod.ts";

// DisposableStack and AsyncDisposableStack are not available yet.
// https://github.com/denoland/deno/issues/20821

// deno-lint-ignore no-explicit-any
(globalThis as any).DisposableStack ??= DisposableStack;
// deno-lint-ignore no-explicit-any
(globalThis as any).AsyncDisposableStack ??= AsyncDisposableStack;
ben-laird commented 4 months ago

Bumping this. This issue is present on the latest canary version as of writing.

My deno --version:

deno 1.43.2+19c0633 (canary, aarch64-apple-darwin)
v8 12.4.254.12
typescript 5.4.5
bartlomieju commented 4 months ago

There's been some movement on this one in the past weeks in V8: https://issues.chromium.org/issues/42203506

We will update to the version that implements DisposableStack as soon as possible.