gpt4 book ai didi

javascript - "WARNING - Suspicious code. The result of the ' getprop' operator is not being used."是什么意思?

转载 作者:数据小太阳 更新时间:2023-10-29 04:15:06 28 4
gpt4 key购买 nike

"WARNING - Suspicious code. The result of the 'getprop' operator is not being used."

当我使用闭包编译器时,我在我的 JavaScript 代码中看到了两行。它们是不报告问题的其他类型定义中的类型定义。我应该寻找什么?

编辑

受影响的代码:

/**
* @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;

警告:

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

为什么警告在那里而不是其他地方?

最佳答案

这意味着您的代码什么都不做。

Typedef(或记录类型)更难让编译器指出问题所在的确切位置,但在某处您得到的值未被使用。

一些关于类型系统的阅读以及什么最适合编译器 https://docs.google.com/document/d/1Uq_vNyPZjlRvYZJclX6N37Fjsiah4XNciEPSBfFiREs/edit

并简单地重新创建警告

if (true) {
//have nothing in here
}

关于javascript - "WARNING - Suspicious code. The result of the ' getprop' operator is not being used."是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9124442/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com