infer parameter type from external type

Hey I am having a really hard time writing some library types. (I don't have experience with types in libraries) Maybe I am missing something: so I have a function with a generic parameter i use to infer the type of an attribute of the paramter which is an object. I want to refactor the object parameter from beeing an inline type to a reusable type outside. Long story short I am pretty much stuck 😅 here is a ts playground with an abstract example of my issue: https://www.typescriptlang.org/play?ssl=7&ssc=2&pln=1&pc=1#code/C4TwDgpgBAggPAFQHxQLxQN4Cgq6gQwC4oEsBfLLAMwFcA7AY2AEsB7OqCAD3wFswANhERIAFGHwAnPgGdiGIiTIBKTDjySIwGpI4TpvGeSA
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
2 Replies
Neto
Neto•14mo ago
like this?
thomzz12
thomzz12•14mo ago
thank you that works :)) idk why i havent thought of that