thomzz12
TTCTheo's Typesafe Cult
•Created by thomzz12 on 5/13/2023 in #questions
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
4 replies