选项 importNotUsedAsValues 已弃用

SSF*_*FHG 5 svelte

有人可以帮我处理这个jsonfig.json文件以实现一个精简的项目吗?它说该importsNotUsedAsValues选项应该替换为verbatimModuleSyntax.

{
  "compilerOptions": {
    "moduleResolution": "Node",
    "target": "ESNext",
    "module": "ESNext",
    /**
     * svelte-preprocess cannot figure out whether you have
     * a value or a type, so tell TypeScript to enforce using
     * `import type` instead of `import` for Types.
     */
    "importsNotUsedAsValues": "error",
    "isolatedModules": true,
    "resolveJsonModule": true,
    /**
     * To have warnings / errors of the Svelte compiler at the
     * correct position, enable source maps by default.
     */
    "sourceMap": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    /**
     * Typecheck JS in `.svelte` and `.js` files by default.
     * Disable this if you'd like to use dynamic types.
     */
    "checkJs": true
  },
  /**
   * Use global.d.ts instead of compilerOptions.types
   * to avoid limiting type declarations.
   */
  "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
}
Run Code Online (Sandbox Code Playgroud)

完整的错误消息是

选项“importsNotUsedAsValues”已弃用,并将在 TypeScript 5.5 中停止运行。指定 compilerOption '"ignoreDeprecations": "5.0"' 来消除此错误。请改用“verbatimModuleSyntax”。

Dam*_*hev 7

根据verbatimModuleSyntax而不是

"importsNotUsedAsValues": "error"
Run Code Online (Sandbox Code Playgroud)

你应该使用

"verbatimModuleSyntax": true
Run Code Online (Sandbox Code Playgroud)

请参阅拉取请求中的详细信息。