我试图将flex-layout添加到有角度的应用程序中,但是当我尝试并使用它时,该应用程序会中断。我已经安装了
npm i @angular/flex-layout @angular/cdk
然后导入到app.module.ts中
import { FlexLayoutModule } from '@angular/flex-layout';
import [ FlexLayoutModule ]
我也将打字稿升级到最新的
npm i typescript@latest
但是,当应用尝试编译时,我会遇到各种错误:
ERROR in node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:24:19 - error TS1086: An accessor cannot be declared in an ambient context.
24 protected get parentElement(): HTMLElement | null;
~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:26:19 - error TS1086: An accessor cannot be declared in an ambient context.
26 protected get nativeElement(): HTMLElement;
~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:28:9 - error TS1086: An accessor cannot be declared in an ambient context.
28 get activatedValue(): string;
~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:29:9 - error TS1086: An accessor cannot be declared in an ambient context.
29 set activatedValue(value: string);
~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/breakpoints/break-point-registry.d.ts:20:9 - error TS1086: An accessor cannot be declared in an ambient context.
20 get overlappings(): BreakPoint[];
~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/breakpoints/break-point-registry.d.ts:24:9 - error TS1086: An accessor cannot be declared in an ambient context.
而这样的例子不胜枚举。我的版本不匹配吗?
谢谢.....
或可能是打字稿版本>
—
Prashant Pimpale
这回答了你的问题了吗?TS1086:无法在环境上下文中声明访问器
—
Prashant Pimpale