离子可选:错误 TS1086:无法在环境上下文中声明访问器
Posted
技术标签:
【中文标题】离子可选:错误 TS1086:无法在环境上下文中声明访问器【英文标题】:ionic-selectable: error TS1086: An accessor cannot be declared in an ambient context 【发布时间】:2020-07-09 03:37:32 【问题描述】:在为 ionic 应用程序构建 prod 模式时——我明白了
[ng] ERROR in node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable-modal.component.d.ts:13:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 13 get _canClearCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable-modal.component.d.ts:14:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 14 get _isMultipleCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable-modal.component.d.ts:15:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 15 get _isSearchingCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable-modal.component.d.ts:16:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 16 get _isios(): boolean;
[ng] ~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable-modal.component.d.ts:18:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 18 get _isAddItemTemplateVisibleCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:16:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 16 get _isMultipleCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:17:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 17 get _hasValueCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:18:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 18 get _hasPlaceholderCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:19:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 19 get _hasIonLabelCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:20:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 20 get _hasDefaultIonLabelCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:21:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 21 get _hasFixedIonLabelCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:22:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 22 get _hasStackedIonLabelCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:23:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 23 get _hasFloatingIonLabelCssClass(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:44:17 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 44 private get _hasInfiniteScroll();
[ng] ~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:45:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 45 get _shouldStoreItemValue(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:70:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 70 get label(): string;
[ng] ~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:79:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 79 get searchText(): string;
[ng] ~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:80:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 80 set searchText(searchText: string);
[ng] ~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:89:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 89 get isSearching(): boolean;
[ng] ~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:98:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 98 get hasSearchText(): boolean;
[ng] ~~~~~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:99:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 99 get value(): any;
[ng] ~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:100:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 100 set value(value: any);
[ng] ~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:117:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 117 get isEnabled(): boolean;
[ng] ~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:118:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 118 set isEnabled(isEnabled: boolean);
[ng] ~~~~~~~~~
[ng] node_modules/ionic-selectable/src/app/components/ionic-selectable/ionic-selectable.component.d.ts:126:9 - error TS1086: An accessor cannot be declared in an ambient context.
[ng] 126 get shouldBackdropClose(): boolean;
[ng] ~~~~~~~~~~~~~~~~~~~
关于如何解决这个问题的任何想法?
【问题讨论】:
【参考方案1】:问题已通过移至解决
ionic-selectable@4.6.0
所以只需执行以下操作:
npm install ionic-selectable@4.6.0 --save
移动到这个版本(我有 4.5.0)来解决这个问题。
希望这会有所帮助。
【讨论】:
我的版本是 4.7.0 并且遇到了这个问题。降级到版本 4.6.0 并已解决 :)以上是关于离子可选:错误 TS1086:无法在环境上下文中声明访问器的主要内容,如果未能解决你的问题,请参考以下文章
@Types/Sequelize 错误 TS1086:无法在环境上下文中声明访问器
错误 TS1086 无法在环境上下文中声明访问器。获取 firebaseUiConfig(): NativeFirebaseUIAuthConfig
angular中安装@angular/cdk时遇到的错误——node_modules/@angular/cdk/table/table.d.ts:277:9 - error TS1086: An ac
angular中安装@angular/cdk时遇到的错误——node_modules/@angular/cdk/table/table.d.ts:277:9 - error TS1086: An ac
angular中安装@angular/cdk时遇到的错误——node_modules/@angular/cdk/table/table.d.ts:277:9 - error TS1086: An ac