0

网址:http ://www.angular-meteor.com/tutorials/socially/angular2/search-sort-pagination-and-reactive-vars

当我按照第 12.4 节的教程进行操作时,编译器总是抱怨:[web.browser] client/parties-list/parties-list.ts (28, 40): Cannot find name 'ReactiveVar

然后,我在命令行中键入“流星列表”,我有以下内容:


accounts-password                1.1.4  Password support for accounts

anti:fake                        0.4.1  Random text and data generator

barbatus:ng2-meteor-accounts     0.1.6  Meteor Accounts for Angular2

barbatus:ng2-meteor-accounts-ui  0.1.3  Meteor Accounts UI for Angular2

barbatus:ng2-pagination          0.1.3  Angular2 Pagination Components

es5-shim                         4.1.14  Shims and polyfills to improve ECMAScr...

jquery                           1.11.4  Manipulate the DOM using CSS selectors

meteor-base                      1.0.1  Packages that every Meteor app needs

mobile-experience                1.0.1  Packages for a great mobile user experi...

mongo                            1.1.3  Adaptor for using MongoDB and Minimongo...

reactive-var                     1.0.6  Reactive variable

session                          1.1.1  Session variable

standard-minifiers               1.0.2  Standard minifiers used with Meteor app...

tracker                          1.0.9  Dependency tracker to allow reactive ca...

urigo:angular2-meteor            0.4.4  Angular2 and Meteor integration

reactive-var 已明确安装。但是为什么编译器仍然抱怨找不到'ReactiveVar'?

4

1 回答 1

0

确保您的输入被正确引用并且是最新的。我正在使用 Meteor 1.2.1 和 ionic2-meteor,所以我有一个打字文件夹。

确保您安装了 Typings NPM 模块。

npm install typings -g

然后安装流星的类型

  typings install meteor --ambient

  typings install es6-promise --ambient

  typings install es6-shim --ambient

在 tsconfig.json 中包含 main.d.ts 文件

"typings": [
      "typings/ionic2-meteor/ionic-framework/ionic.d.ts",
      "typings/ionic2-meteor/ionic2-meteor.d.ts",
      "typings/angular2-meteor/angular2-meteor.d.ts",
      "typings/main.d.ts"
    ]

确保安装的 meteor.d.ts 文件包含以下内容:

declare var ReactiveVar: ReactiveVarStatic;
interface ReactiveVarStatic {
    new<T>(initialValue: T, equalsFunc?: Function): ReactiveVar<T>;
}
interface ReactiveVar<T> {
    get(): T;
    set(newValue: T): void;
}

就我而言,我必须更新我的 meteor.d.ts 文件(主文件和浏览器),因为它们不包含 ReactiveVar 声明和接口。

于 2016-04-16T18:16:15.120 回答