Skip to content

Unclosed 'new Set(' wrecks resolutions to packages in nodenext #46373

Closed
@DanielRosenwasser

Description

@DanielRosenwasser
  1. Create a new package

  2. npm install node-fetch (or whatever package)

  3. Set up a tsconfig.json with nodenext as the module mode.

     { "compilerOptions": { "module": "nodenext", "noEmit": true, "strict": true } }
  4. Add the following code

    import * as fetch from "node-fetch";
    
    const b = /**/someList.filter(a => a.startsWith("@types"))
  5. At the cursor /**/, type in new Set(

    import * as fetch from "node-fetch";
    
    const b = new Set(/**/someList.filter(a => a.startsWith("@types"))
  6. Notice that the resolution to node-fetch is now borked.

  7. Complete the parentheses on the other side

    import * as fetch from "node-fetch";
    
    const b = new Set(someList.filter(a => a.startsWith("@types")))/**/
  8. The resolution to node-fetch is likely still failing. If so, try to type a ;. That may fix it.

    import * as fetch from "node-fetch";
    
    const b = new Set(someList.filter(a => a.startsWith("@types")));/**/

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions