Skip to main content
3 votes
2 answers
136 views

I am working on a small side project that uses a very simple command handler pattern for dispatching command classes to handler classes. I come from a C# background, and am running into an issue with ...
rob's user avatar
  • 1,216
3 votes
1 answer
69 views

I'm trying to implement TryFrom over a type parameter, like so: enum MyType {} struct MyError(); impl<T: Into<u8>> TryFrom<T> for MyType { type Error = MyError; fn try_from(...
Tobiky's user avatar
  • 115
0 votes
1 answer
87 views

With the deprecation of MappingJacksonValue in spring boot 4/Jackson 3, I'm trying to figure out how to serialize my objects based on a JsonView. I have the following SSE endpoint : @GetMapping(...
Mathis Dousse's user avatar
4 votes
1 answer
99 views

I'm trying to hint that a Pydantic BaseModel field needs to be the class tuple or one of its subclasses, so I've typed the field as type[tuple]: from pydantic import BaseModel class Task1(BaseModel): ...
bin9980's user avatar
  • 71
Advice
0 votes
0 replies
70 views

function getProp<T, K extends keyof T>(obj: T, key: K): T[K] { return obj[key]; } I'm only a week into learning TS, and I was only wondering why this couldn't be written as function getProp&...
Mg Gm's user avatar
  • 151
1 vote
0 answers
105 views

I am trying to create a custom generic repository using the fragment interface approach as described in this article: https://docs.spring.io/spring-data/jpa/reference/repositories/custom-...
Sidharth Bajpai's user avatar
2 votes
1 answer
68 views

The Announcing F #7 page gives the example code type IAddition<'T when 'T :> IAddition<'T>> = static abstract op_Addition: 'T * 'T -> 'T type Number<'T when IAddition<'T&...
CarbonFlambe's user avatar
Advice
3 votes
8 replies
108 views

Suppose there's an interface interface IAnimal { IFood GetPreferredFood(); } and a class class Cat<F>(F food) : IAnimal where F : IFood { private F _food = food; public F ...
Massimiliano Micol's user avatar
Best practices
0 votes
1 replies
41 views

I'm building a simulation engine in Python and want to use generics so that events are strongly typed to a simulation state. I have something like this: from __future__ import annotations from abc ...
Davis Cotton's user avatar
-1 votes
0 answers
84 views

I'm building a HATEOAS implementation in ASP.NET Core using a LinkCollectionWrapper<T> class that wraps a collection of entities and stores links. My classes look like this: public class ...
Hossein Dara's user avatar
2 votes
1 answer
60 views

I find myself having to write X extends Y = Y a lot when creating types in TypeScript, for example: type T<V extends X = X> = ... When my types get very long (working on a personalized, type-...
Bimo's user avatar
  • 1,384
3 votes
1 answer
95 views

I have an object that could be either a "name" or a "call", and I want it to end up as a "call". By a "name" object, I mean like something created by bquote(), ...
Dagremu's user avatar
  • 521
Advice
0 votes
1 replies
58 views

I'm learning about delegates in C# and came across a pattern that I don't fully understand. I have a generic method that returns an Action<T>, which I expect to be a method that accepts one ...
satanmoo's user avatar