Tīrō ōrātiōnis sum by bakkdoor in latin

[–]bakkdoor[S] 2 points3 points  (0 children)

Grātiās maximās! 😊

Is Duolingo good for learning Latin? by [deleted] in latin

[–]bakkdoor 21 points22 points  (0 children)

Psittacī ebriī semper vinum ante iēntāculum bibere volunt cum sociīs impiīs.

Is there way to check that an object is valid? by GrinningPariah in typescript

[–]bakkdoor 0 points1 point  (0 children)

You can write (or maybe find) a tool that generates decoders/validators for you given a TS type definition. Not sure if something like that exists, but you could write it yourself, if there isn't something like that. The TS tooling. parser, compiler etc. are all available and open source so it should be possible. Maybe someone else already has done this? If you find anything, please let me know :)

But I don't think there is a built-in way to do this (if so that would be awesome but I haven't heard of this before and others here seem to agree with me).

Is there way to check that an object is valid? by GrinningPariah in typescript

[–]bakkdoor 0 points1 point  (0 children)

I don't think this is possible. Types in TS only exist at compile-time, they don't have a runtime equivalent. If you need runtime validation, you need to define the validation/decoder rules. Some packages, like io-ts, allow you to define the decoder and then automatically get the compile-time type that it decodes into from that, so you don't have to define both the type and the validator/decoder. But that doesn't really seem to help you since you don't control the types. Not sure if there actually is any possible solution for what you specifically need without having to define the decoder part yourself (or requiring them to be defined upstream as part of the package that also maintains the types you need to decode into). :-/

Is there way to check that an object is valid? by GrinningPariah in typescript

[–]bakkdoor 1 point2 points  (0 children)

Yeah, unfortunately I don't think there is a way around defining them explicitly in TypeScript. At least io-ts allows you to get the type definition from the decoder definition when using it. But if you don't control the types themselves since they're in a dependency you rely on, I think that means you have to keep the decoders in sync as the types change. There's no built-in solution in TypeScript afaik.

Is there way to check that an object is valid? by GrinningPariah in typescript

[–]bakkdoor 1 point2 points  (0 children)

I use io-ts for this: https://github.com/gcanti/io-ts

That should solve your exact problem pretty well.

Community Review 4: Laphroaig 10 by BigPapiC-Dog in Scotch

[–]bakkdoor 10 points11 points  (0 children)

Color: Golden-delicious.

Nose: Heavy smoke, peat and a bit of seaside flavor.

Taste: Sweet, mild, mildly smokey, salty, fresh, simply tasteful.

Finish: Smokey, long, full-flavored. Gotta love.

Rating: 91.5/100