本文介绍了TypeScript编译中缺少in-memory-data.service.ts的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Anghular教程中逐步了解如何使用http请求 https://angular.io/tutorial/toh-pt6 ,我明白了这一点:

Walking through Anghular tuturial on how to use http requests inhttps://angular.io/tutorial/toh-pt6, I got to this point:

那我遇到了这个问题,知道如何解决吗?

Then I came across this issue, any idea how to solve it?

这是tsconfig.json

Here is the tsconfig.json

/*
  This is a "Solution Style" tsconfig.json file, and is used by editors and TypeScript’s language server to improve development experience.
  It is not intended to be used to perform a compilation.

  To learn more about this file see: https://angular.io/config/solution-tsconfig.
*/
{
  "files": [],
  "references": [
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.spec.json"
    }
]
}

这是tsconfig.app.json

Here is the tsconfig.app.json

/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
  "extends": "./tsconfig.base.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}

这是tsconfig.base.json

Here is the tsconfig.base.json

/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "module": "es2020",
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

这是tsconfig.spec.json

Here is tsconfig.spec.json

/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
  "extends": "./tsconfig.base.json",
  "compilerOptions": {
    "outDir": "./out-tsc/spec",
    "types": [
      "jasmine"
    ]
  },
  "files": [
    "src/test.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.spec.ts",
    "src/**/*.d.ts"
  ]
}

推荐答案

面临相同的问题.最后,解决问题的方法只是重新运行ng serve(更准确地说,再次单击PyCharm上的运行'Angular CLI服务器".

Was facing the same issue. In the end, what solved it was just re-running ng serve (more precisely, clicking "Run 'Angular CLI Server" on PyCharm again.

这篇关于TypeScript编译中缺少in-memory-data.service.ts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 03:28