16
yehaaw
2y

Someone actually wrote this shit. Not once, not twice - it’s fucking everywhere.

Comments
  • 4
  • 2
    I've had cases where things like that are, unfortunately, necessary 😣
  • 2
    Maybe strip the maybe's.. I mean.. doesn't "property?: Type" already say "maybe" in a more concise way? I call semantic overload

    And why Scalar['String'] and not just String? If everything is Maybe what use does TS even have except editor intellisense
  • 4
    LGTM :shipit:
  • 1
    Well, it is close to being okay: undefined|T or null|T (decide on one and use it consistently) is how you define a Maybe<T> in TypeScript. And the question mark makes the presence of the property optional (which isn't the same as it having a value of undefined or null). Also i wouldn't allow optionals as values in sets and arrays.

    And i think, i found the culprit: https://non-traditional.dev/the-pow...
  • 0
    Scalars['File'] makes me feel violent.
  • 2
    Shopify devs write code however they want.
  • 0
    Maybe it works
  • 0
    @Oktokolo I know but as an API consumer/ JS SDK user whether the prop is not on the response or undefined or null is functionally equivalent in the majority of cases (if (!res.prop)
  • 0
    @webketje Yes, but someone has to actually create that objects. And while it should also be functionally equivalent for them, it sadly isn't.

    Enetrprise language design at its best. At least there is no SOAP involved in any way...
Add Comment