【发布时间】:2026-01-21 03:00:02
【问题描述】:
我正在使用 angular 和 typescript 版本 2.7.1。我收到以下错误:
“环境上下文中不允许使用初始化程序。
'any' 仅指一种类型,但在这里用作值。
模块 D/Mean/CRUD/project/AngularApp/node_modules/rxjs/operators/index 没有导出成员 'toPromise'。
【问题讨论】:
-
请向我们展示您的代码!
-
显示错误所在的employee.component.ts
-
声明 var M = any;
-
declare var M = any; @Component({ selector: 'app-employee', templateUrl: './employee.component.html', styleUrls: ['./employee.component.css'], providers: [EmployeeService] }) export class EmployeeComponent implements OnInit { -
import { map } from 'rxjs/operators'; import { toPromise } from 'rxjs/operators';
标签: angular typescript