0
我尝试运行npm start
我angular2项目变量a隐含有 '任何[]' 型
,但得到这个错误:
push_quick git:(master) npm start
> [email protected] start /Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/push_quick
> tsc && concurrently "tsc -w" "lite-server"
app/shared/stringUtils.service.ts(8,9): error TS7005: Variable 'a' implicitly has an 'any[]' type.
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/6.3.1/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `tsc && concurrently "tsc -w" "lite-server" `
npm ERR! Exit status 2
npm ERR!
此方法:
@Injectable()
export class StringUtilsService {
mapToFormParamsString(dict : any) : string{
var a:any[] = []
for (var key in dict) {
if (dict.hasOwnProperty(key)) {
a.push(key+"="+dict[key]);
}
}
return a.join("&");
}
}
我该如何解决这个问题?
改变var a = string[]
或var a = any[]
没有帮助。相同的编译错误。
顺便说一句,与ng start
或的IntelliJ
是ng start
调用mpn start
或反之亦然编译时我没有THI错误?
谢谢!顺便说一句,我没有与ng开始编译时或在intellij 怎么会出现thi错误? ng是否开始拨打mpn start或反之亦然? –