Getting a modified type from a class marked by decorator

Viewed 17

I have a class defined like:

class Person {
    @OneToOne()
    pet: Animal;
}

Is there a way to get a modified type which looks like this? (Adding {propertyKey}Id: string to properties by marking it with a decorator)

// Using generics
type ModifiedPerson = SomeGeneric<Person>

// Or maybe using functions?
type ModifiedPerson = typeof someFunc(Person);

// Equivalent as:
type ModifiedPerson = {
    pet: Animal,
    petId: string,
}
1 Answers
Related