[Proposal] - Supporting Generic properties in model
See original GitHub issueSorry if this is a duplicate.
interface StoreModel<K extends {}> {
data: K;
act: Action<StoreModel<K>, void>;
}
function doSomething<K extends {}, S extends StoreModel<K>>(
s: State<S>,
a: Actions<S>
) {
a.act();
return s.data;
}
According to Typescript, act and data don’t exist on a and s, respectively.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
[Proposal] Allow generic attributes · Issue #953 · dotnet/roslyn
Suggestion. I suggest that the generic attributes should be supported, including any generic constraints. Usage example: [TypeConverter<X> ...
Read more >Generic attributes - C# 11.0 draft specifications
This feature specification describes generic attributes, where a generic class may derive from 'System.Attribute'.
Read more >Type Parameters Proposal
Generic functions may only use operations supported by all the types permitted by the constraint. Using a generic function or type requires ...
Read more >Re: Generic Property-Value Proposal for Schema.org
I'm less convinced by the argument "generic extension mechanism for properties at the level of schema.org". As you note, using external ...
Read more >Is there possible to support inheriting from a generic type: ...
Recently, I tried to write a generic class to extend UIViewController and its all subclasses, so I wrote some codes like this:
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I might have a solution for this. Will keep u posted 👍
Cheers Sean! Great response time as always 😃
For now I’ve limited the extending functionality to just overriding existing actions, reducing
doSomethingto justwhich does the trick but isn’t ideal. The top answer on StackOverflow was an adventure, hopefully you can work that into a solution 😄