我如何将Ionic 4与aspnetboilerplate集成在一起,没有任何打字稿错误?

问题描述 投票:0回答:1

我正在尝试将离子4集成为aspnetboilerplate的前端后端API。

我已经从示例Angular前端复制了一些代码,并添加了我需要的所有软件包。我只复制了auth文件夹和服务代理文件夹,因此可以将ASP .net样板身份验证添加到ionic应用程序。 VS Code未检测到abp软件包,并显示导入错误,直到我还复制了typings.d.ts文件,该文件删除了编辑器中的错误。

//typings.d.ts snippet

///<reference path="../node_modules/abp-web-resources/Abp/Framework/scripts/abp.d.ts"/>
///<reference path="../node_modules/abp-web-resources/Abp/Framework/scripts/libs/abp.jquery.d.ts"/>
///<reference path="../node_modules/abp-web-resources/Abp/Framework/scripts/libs/abp.signalr.d.ts"/>

[当尝试使用ionic serve运行应用程序时,遇到与添加Typeings.d.ts文件之前相同的错误。

ERROR in node_modules/abp-ng2-module/dist/src/features/feature-checker.service.d.ts:2:31 - error TS2503: Cannot find namespace 'abp'.

src/account/account.component.ts:34:9 - error TS2592: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery` and then add `jquery` to the types field in your tsconfig.

我认为问题是VS Code识别了typings.d.ts文件,而实际的离子打字稿安装却没有。

angular typescript ionic-framework aspnetboilerplate
1个回答
0
投票

您需要在typestyperoots属性中添加对tsconfig.json文件的引用。

  {
   "compilerOptions": {
       "typeRoots" : ["node_modules/abp-web-resources/Abp/Framework/scripts"]
   }
  }

您可以查看文档here

© www.soinside.com 2019 - 2024. All rights reserved.