Which means "WARNING - Suspicious code. The result of using" getprop "is not used." I mean?

"WARNING - Suspicious code. The result of the getprop statement is not used.

I see this for two lines in my JavaScript code when I use the closure compiler. They are typedefs among other typedefs that do not report problems. What should I look for?

EDIT

Affected Code:

/** * @typedef {{playerId: number, playerName: string, baseScores: Array.<number>, bonusScores: Array.<number>, * teamScoreAdjustments: Array.<number>}} */ wias.GameTableTeamMember; /** * @typedef {{id: number, teamMembers: Array<wias.GameTableTeamMember>, teamName: string}} */ wias.GameTableTeam; /** * @typedef {{id: number, availableRound: boolean, bonusScoring: boolean, complete: boolean, gameLength: number, * gameType: string, lastPlayed: string, numberOfRounds: number, teams: Array.<wias.GameTableTeam>, winners: * Array.<string>}} */ wias.GameTable; 

Attention:

 wias.js:77: WARNING - Suspicious code. The result of the 'getprop' operator is not being used. wias.GameTableTeam; ^ 

Why is the warning there and not somewhere else?

+7
source share
1 answer

This means that you have code that does nothing.

Typedef (or record types) is more complicated for the compiler to indicate the exact place where the problem is, but somewhere you get a value that is not used.

some reading about the type system and what works best with the compiler https://docs.google.com/document/d/1Uq_vNyPZjlRvYZJclX6N37Fjsiah4XNciEPSBfFiREs/edit

and just recreate the warning

 if (true) { //have nothing in here } 
+6
source

All Articles