exaV / screeps-kotlin-types

Screep's Kotlin type definitions
MIT License
17 stars 18 forks source link

Make Market.CreationParams extend Options for easier usage #52

Closed magnusesp closed 4 years ago

exaV commented 4 years ago

We cannot make CreationParams extend Option because options is inherently unsafe. We documented this on the Options interface: Indicates type is an external interface with only mutable and nullable properties.

So unless we can make the properties mutable and nullable (depends on screeps api) we cannot extend Options.

exaV commented 4 years ago

From the discussion on slack (since it is not persistent there):

I see how it may be a bit cumbersome to instantiate GoalWithRange because we need to create a class implementing the interface first and I agree we should provide an out of the box way, since everyone has to do it otherwise. Since these types are never returned (instantiated by the engine) we could make it a (data) class where the required members are declared in constructor and annotate its members with JsName so they get mapped correctly