You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the IS_REO packet, which can be sent and received (both ways), the ReqI property is described as "0 unless this is a reply to an TINY_REO request". In code, it is declared as readonly with the default value of 0, which restricts its type to just 0. This causes issues when trying to compare the received ReqI in the packet event handler, which can be any number.
/** 0 unless this is a reply to an {@link TINY_REO} request */
@byte()readonlyReqI=0;
Example vent hander in an application:
inSim.on(PacketType.ISP_REO,(packet)=>{console.log(packet.ReqI===2);// Error TS2367: This comparison appears to be unintentional because the types 0 and 2 have no overlap.});
Solution
Remove the readonly modifier from ReqI declaration, which will widen its type to number.
The text was updated successfully, but these errors were encountered:
Problem
In the IS_REO packet, which can be sent and received (both ways), the
ReqI
property is described as "0 unless this is a reply to an TINY_REO request". In code, it is declared asreadonly
with the default value of0
, which restricts its type to just0
. This causes issues when trying to compare the receivedReqI
in the packet event handler, which can be any number.node-insim/src/packets/IS_REO.ts
Lines 32 to 33 in 533d107
Example vent hander in an application:
Solution
Remove the
readonly
modifier fromReqI
declaration, which will widen its type tonumber
.The text was updated successfully, but these errors were encountered: