Variable 'a' a implicitement un type 'tout []'

voix
0

J'essaie de courir npm startpour mon projet angular2

mais obtenir cette erreur:

  push_quick git:(master) npm start

> angular2-quickstart@1.0.0 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! angular2-quickstart@1.0.0 start: `tsc && concurrently tsc -w lite-server `
npm ERR! Exit status 2
npm ERR!

pour cette méthode:

@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(&);
  }
}

Comment puis-je réparer cela?

changer var a = string[] ouvar a = any[]

n'a pas aidé. même erreur de compilation.

BTW, je n'ai pas eu thi erreur lors de la compilation avec ng startou IntelliJ

Est -ce l' ng startappel mpn startou vice versa?

Créé 30/08/2016 à 22:00
source utilisateur
Dans d'autres langues...                            


1 réponses

voix
1

Probablement, dans les strinUtils.service.ts. Un membre ou une variable du componenet n'a pas de type explicite. Un moyen rapide de fixer, puisque vous ne fournissez pas le code de service, peut être

var a:string[] = [] 

L'erreur se produit montré sur les validations de peluchage, parfois si le linter est pas le passage il se casse le moteur d'exécution de la compilation.

Créé 30/08/2016 à 22:05
source utilisateur

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more