screepers / simpleAllies

Allows for simple communication between allies using a public segment
MIT License
1 stars 4 forks source link

Remove the response types and fix typing init. #7

Closed f4hy closed 9 months ago

f4hy commented 9 months ago

The response types are only defined in the TS but not the JS. They don't belong in this code. They can be an example of how someone would extend this to track their own responses but should not be included here as they are not part of the public segment interface this is trying to communicate.

Also AllyRequests should not have all the lists be ?. If it does then the functions using it need guardslike

    requestResource(args: ResourceRequest) {
        if(!this.myRequests.resource){
            this.myRequests.resource = [args]
        }
        else{
            this.myRequests.resource.push(args)
       }
    }

to pass type safety. Instead of adding that everywhere we can just make them non optional and fix the init.