You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interface Thing {
name: string;
children: Array<Thing>;
}
type x = ResponseWithBody<200, Array<Thing>>;
Could be immutable types:
interface ReadonlyThing {
readonly name: string;
readonly children: ReadonlyArray<Thing>;
}
type x = ReadonlyResponseWithBody<200, ReadonlyArray<ReadonlyThing>>;
This would be a breaking change, so maybe mutable types by default and opt-in to immutable types, by configuration flag.
Although my personal preference would be immutable by default.
Reason being is that I'm using functional programming paradigm, where immutable data-structures are preferred, to avoid accidental state mutation as a safety feature.
The text was updated successfully, but these errors were encountered:
+1 on this! My expectation in my projects as well. I think to support backwardscompatibility we should make it an opt-in feature.
A bit of a side track - this brings up the good question on how we want to handle backwards compatibility overall. I.e. when do we want to say its ok to break something, and when do we want to keep backwards compatibility? I don't see a clear rule for this myself. @scottc, @Markionium - thoughts?
Generated mutable types:
Could be immutable types:
This would be a breaking change, so maybe mutable types by default and opt-in to immutable types, by configuration flag.
Although my personal preference would be immutable by default.
Reason being is that I'm using functional programming paradigm, where immutable data-structures are preferred, to avoid accidental state mutation as a safety feature.
The text was updated successfully, but these errors were encountered: