[CodeFactor] Apply fixes (#8)

Co-authored-by: codefactor-io <support@codefactor.io>
This commit is contained in:
codefactor-io[bot] 2022-08-01 18:50:58 +02:00 committed by GitHub
parent 4f60afa9d9
commit 56aa830e6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,7 @@ const retWarn = (msg: string) => c.warn(msg);
export default async function handle(session: Session, packet: Packet) {
const body = packet.body as PlayerGetTokenCsReq;
let dataObj = {
const dataObj = {
retcode: 0,
secretKeySeed: 0
} as PlayerGetTokenScRsp;

View File

@ -13,10 +13,10 @@ class MessageType<T> {
// "toJSON": (message: T)=> unknown
//you can add more fields here from the generated types
//fromjson etc...
};
}
var messageTypeMap = new Map<PacketName, MessageType<any>>();
var messageTypeMapReversed = new Map<MessageType<any>, PacketName>();
const messageTypeMap = new Map<PacketName, MessageType<any>>();
const messageTypeMapReversed = new Map<MessageType<any>, PacketName>();
function send<Class extends MessageType<T>, T>(type: Class, data: T) {
console.log(type.encode(data).finish())
@ -44,7 +44,7 @@ export default class ProtoFactory {
static init() {
//iterate over everything in types and check if they are a MessageType
for (const key of Object.keys(types)) {
let value = types[key as keyof typeof types];
const value = types[key as keyof typeof types];
if (isMessageType(value)) {
if (Object.values(CmdID).includes(key)) {
messageTypeMap.set(key as PacketName, value);