为什么在Angular 5中错误为:没有导出的成员'OpaqueToken'? [英] Why error in Angular 5 as : has no exported member 'OpaqueToken'.?

查看:320
本文介绍了为什么在Angular 5中错误为:没有导出的成员'OpaqueToken'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Angular 4应用程序,我正在升级到Angular5.

I have an Angular 4 application, which I am upgrading to Angular 5.

我遇到以下错误.

src/app/application/services/produced/variables.ts(1,10)中的

ERROR: 错误TS2305:模块 '"..../node_modules/@ angular/core/core"' 没有导出的成员"OpaqueToken".

ERROR in src/app/application/services/generated/variables.ts(1,10): error TS2305: Module '"..../node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.

代码段是:

import { OpaqueToken } from '@angular/core';

export const BASE_PATH = new OpaqueToken('basePath');
export const COLLECTION_FORMATS = {
    'csv': ',',
    'tsv': '   ',
    'ssv': ' ',
    'pipes': '|'
}

此代码是由 swagger编辑器生成的.

推荐答案

OpaqueToken已被删除.您必须改为使用InjectionToken. 我正面临着同样的问题. 目前,最佳"解决方案是在每次生成代码后都替换令牌.但这不是永久的解决方案.

The OpaqueToken got removed. You have to use the InjectionToken instead. I am facing the same problem. At the Moment the "best" solution is to replace the tokens after each code-gen build. But thats not a permanent solution.

请对此问题做出贡献: https://github.com/swagger-api/swagger-codegen/issues/7324

Please contribute to this issue: https://github.com/swagger-api/swagger-codegen/issues/7324

这篇关于为什么在Angular 5中错误为:没有导出的成员'OpaqueToken'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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