3 ms·
> drastically different ways to approach types Exactly. > Partial<T> Looking at that it's just what a default POJO (with nullable properties) already is, so
by tpm 2y ago
> drastically different ways to approach types
Exactly.
> Partial<T>
Looking at that it's just what a default POJO (with nullable properties) already is, so I'd see no need to represent that in Java.
Looks cool though and I like Typescript; my issue with it is that it needs transpiling to run. If it was a first-class citizen in an environment I would use it for my pet projects.
- crabmusket 2y ago> it's just what a default POJO (with nullable properties) already is I think you missed the point. Partial<T> is an example of a "mapped type", see the handbook for more explanation: https://www.typescriptlang.org/docs/handbook/2/mapped-types.html https://www.typescriptlang.org/docs/handbook/2/mapped-types....
- svieira 2y agoYep - all non-primitive types in Java are `TheType | null` - TypeScript actually allows you to strip out the `| null`, which then means that sometimes you want to add it back in. So Java doesn't have a need for `Partial<T>`, it has a need for `NonNull<T>` and it can't express that at the type system level very easily right now (you can do it with type tagging and runtime checks inserted explicitly, but it's not very ergonomic right now) https://gist.github.com/svieira/9f8beeafb7bf4aa55d40c638532f4fd7 https://gist.github.com/svieira/9f8beeafb7bf4aa55d40c638532f...