KEMBAR78
issues with `"moduleResolution": "Node16"` inside `tsconfig.json` · Issue #1965 · sveltejs/language-tools · GitHub
Skip to content

issues with "moduleResolution": "Node16" inside tsconfig.json #1965

@ivanhofer

Description

@ivanhofer

Describe the bug

When setting moduleResolution to Node16 inside tsconfig.json I encounter two issues:

  1. the "zero-effort typesafety" functionality stops working

  2. if I run svelte-check:watch and safe the tsconfig.json file, the process crashes with following error message

    Watching for file changes.../home/my-app/node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/typescript.js:139552
            return !!entry.sourceFile;
                           ^
    
    TypeError: Cannot read properties of undefined (reading 'sourceFile')
        at isDocumentRegistryEntry (/home/my-app/node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/typescript.js:139552:24)
        at getDocumentRegistryEntry (/home/my-app/node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/typescript.js:139612:25)
        at Object.releaseDocumentWithKey (/home/my-app/node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/typescript.js:139718:25)
        at /home/my-app/node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/typescript.js:169519:45
        at Object.forEach (/home/my-app/node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/typescript.js:181:30)
        at Object.dispose (/home/my-app/node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/typescript.js:169518:20)
        at dispose (/home/my-app/node_modules/.pnpm/svelte-check@3.1.4_svelte@3.57.0/node_modules/svelte-check/dist/src/index.js:90308:25)
        at watchConfigCallback (/home/my-app/node_modules/.pnpm/svelte-check@3.1.4_svelte@3.57.0/node_modules/svelte-check/dist/src/index.js:90343:9)
        at /home/my-app/node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/typescript.js:6724:17
        at /home/my-app/node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/typescript.js:6439:180
    

Reproduction

demo repository: https://github.com/ivanhofer/svelte-check-moduleresolution-node16

  1. /routes/+page.svelte contains an error. If you run svelte-check nothing shows up. data is typed as any.
    Once moduleResolution removed from the tsconfig.json, the error shows up.
  2. run check:watch and hit save on the opened tsconfig.json file. The process should crash.
    Once moduleResolution removed from the tsconfig.json, saving that file does not crash the process.

Expected behaviour

I would expect the Svelte language-tools also to function with moduleResolution set to Node16

System Info

  • OS: WSL with Ubuntu 22.04 on Windows 11
  • IDE: VSCode

Which package is the issue about?

Svelte for VS Code extension, svelte-language-server, svelte-check

Additional Information, eg. Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions