Unclosed 'new Set(' wrecks resolutions to packages in nodenext · Issue #46373 · microsoft/TypeScript (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@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")));/**/