如何复制:
创造一些东西--ng
cd Something
现在关注此链接https://docs.nativescript.org/angular/core-concepts/accessing-native-apis-with-javascript.html
npm install tns-platform-declarations --save-dev
替换了tsconfig.json和reference.d.ts
的内容运行iOS
我正在
file:///app/tns_modules/@angular/compiler/bundles/compiler.umd.js:18646:26:JS ERROR错误:无法解析ItemsComponent的所有参数:(?)。
版本2.1.6
xcode版本8.2.1
“tns-platform-declarations”:“^ 2.5.0”,
“tns-ios”:{“version”:“2.5.0”}
“nativescript-angular”:“1.4.0”,
没有这些修改,iOS项目按预期运行。
我觉得它有引用的东西,但我不确定。
答案 0 :(得分:4)
在启用Angular-2的项目中工作时,需要处理一些与DOM相关的类型。这将在nativescript-dev-typescript的下一个版本中处理,但同时在references.d.t.s中使用以下内容
// <reference path="./node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
declare type Comment = any;
declare type CloseEvent = any;
declare type Document = any;
declare type DocumentFragment = any;
declare type Element = any;
declare type History = any;
declare type HTMLAnchorElement = any;
declare type HTMLCollection = any;
declare type HTMLDocument = any;
declare type HTMLElement = any;
declare type HTMLInputElement = any;
declare type HTMLScriptElement = any;
declare type HTMLStyleElement = any;
declare type KeyboardEvent = any;
declare type Location = any;
declare type MessageEvent = any;
declare type MouseEvent = any;
declare type Node = any;
declare type NodeList = any;
declare type Text = any;
declare type WebSocket = any;