GlassBricks / typed-factorio

Complete and featureful Typescript defintions for the Factorio modding API
MIT License
33 stars 3 forks source link

Alternative to `satisfies` #20

Closed Dimava closed 9 months ago

Dimava commented 9 months ago

In my opinion, you don't do like

data.extend([
   {
     type: "ammo-category",
     name: "foo",
   } satisfies AmmoCategory,
   { 
     type: "item",
     name: "bar",
     // other fields...
   } satisfies ItemPrototype,
])

You do like

data.extend<AmmoCategory | ItemPrototype>([
   {
     type: "ammo-category",
     name: "foo",
   },
   { 
     type: "item",
     name: "bar",
     // other fields...
   },
])

This is more simple if you have one type and many items

Consider adding this as an option in readme

GlassBricks commented 9 months ago

Good suggestion; I've updated the Readme with this as an option.