Ngrx对较低版本的打字稿的影响不起作用 [英] Ngrx effects on lower version of typescript doesn't work

查看:72
本文介绍了Ngrx对较低版本的打字稿的影响不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Ionic 3应用程序,我在其中使用 ngrx/store ngrx/effects .但是每次我尝试运行该应用程序时,它都会在下面显示此错误:

I have an Ionic 3 App where I use ngrx/store and ngrx/effects. But each time I try to run the app it sais this error below:

TypeScript错误类型文字中的计算属性名称必须 直接引用内置符号. ...:找不到名称任何".

TypeScript Error A computed property name in a type literal must directly refer to a built- in symbol. ...: Cannot find name 'any'.

在我的节点模块中引用此文件夹 node_modules/@ngrx/effects/src/on_run_effect.d.ts

which refers to this folder in my node modules node_modules/@ngrx/effects/src/on_run_effect.d.ts

下面的这段代码:

export declare function isOnRunEffects(sourceInstance: {
    [onRunEffectsKey]?: onRunEffectsFn;
}): sourceInstance is OnRunEffects;

可以通过安装更高版本的 typescript 来解决此问题,但截至目前,我正在使用 2.6.1 ,但是当我将其升级到更高版本的 >打字稿,我的应用无法在生产上运行,甚至console.log方法也无法运行.

This can be fix by installing higher version of typescript but as of now currently I am using 2.6.1 but when I upgrade it to a higher version of typescript my app doesn't work on production and even the console.log methods are not working.

以下是我的离子信息:

Ionic:

   ionic (Ionic CLI)  : 4.0.0-rc.13 (/home/clifford/.npm-global/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : browser 5.0.4

System:

   Android SDK Tools : 26.1.1
   NodeJS            : v6.12.2 (/usr/local/bin/node)
   npm               : 4.6.1
   OS                : Linux 4.13

Environment:

   ANDROID_HOME : /home/clifford/Android/Sdk

感谢有人可以帮助您. 预先感谢.

Appreciate if someone could help. Thanks in advance.

推荐答案

可能是您正在使用内部使用打字稿3.1.x的最新版本.请尝试将打字稿2.6.x降级到特定版本(5.2.0).并检查它.

May be you are using latest version which is internally uses typescript 3.1.x. Please try to downgrade to the specific version (5.2.0) for typescript 2.6.x. and check it.

npm install @ngrx/store@5.2.0 @ngrx/effects@5.2.0 --save

这篇关于Ngrx对较低版本的打字稿的影响不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆