microsoft / microsoft/TypeScript-Website

Global errors differ depending on initial state of playground

Open
#3,032 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Playground
Dominant language
TypeScript
Stars
2.6k
Forks
1.5k
Avg merge
2d 2h
Merged PRs (30d)
7

Description

I'm having a hard time consistently reproing this, so bare with me.

First, use es2020 as a target.

Playground for this example:

function foo() {
    await using asd = 123;
}

Playground for this example:

function foo() {
    //await using asd = 123;
}

In both cases, toggle a comment on the line in foo, and then toggle the comment state again.

Depending on the initial contents of the playground, the following errors will not reappear:

Cannot find global type 'AsyncDisposable'.(2318)
Cannot find global type 'Disposable'.(2318)

What's more, if you try applying a quick fix on the await keyword to add the async keyword to the function you may get different results than if you enter it manually.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the two linked Playground examples using the es2020 target, then reproduce the comment toggling sequence in foo. Compare whether the AsyncDisposable and Disposable diagnostics and the await quick-fix remain consistent after each toggle; done means both initial states produce the same errors and quick-fix result.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.