Variabile 'a' implicitamente ha un 'qualsiasi []' type

voti
0

Io cerco di correre npm startper il mio progetto angular2

ma questo errore:

  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!

per questo metodo:

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

come posso risolvere questo problema?

la modifica var a = string[] ovar a = any[]

non ha aiutato. stesso errore di compilazione.

btw, non ho avuto Thi errore durante la compilazione con ng starto in IntelliJ

Sta ng startchiamando mpn starto viceversa?

È pubblicato 30/08/2016 alle 22:00
fonte dall'utente
In altre lingue...                            


1 risposte

voti
1

Probabilmente, nei strinUtils.service.ts. Un membro o di una variabile del tipo componenet ha non esplicito. Un modo rapido per risolvere, dal momento che non stanno fornendo il codice di servizio, può essere

var a:string[] = [] 

L'errore mostrato accade sulle convalide linting, a volte se il linter non passa rompe il runtime compilazione.

Risposto il 30/08/2016 a 22:05
fonte dall'utente

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