Currently, when defining properties of type function or object, only these type unsafe definitions are accepted.
The ability to define more specific types would greatly improve the quality and readability of the code.
I have 2 ideas in my mind how this could be achieved.
The first would be a more type guess based aproach like the following:
The idea is to define them as type-safe TS types and convert them to the simple type with the transformation to js.
In the case of the example, the metadata would be rewritten to type: "function".
Alternatively, if guessing the type would be too difficult, since some object types can be very complex, enhancing the property with an additional key could make it easier and enable the useage of interfaces and named types:
Currently, when defining properties of type function or object, only these type unsafe definitions are accepted. The ability to define more specific types would greatly improve the quality and readability of the code.
I have 2 ideas in my mind how this could be achieved. The first would be a more type guess based aproach like the following:
The idea is to define them as type-safe TS types and convert them to the simple type with the transformation to js. In the case of the example, the metadata would be rewritten to
type: "function"
.Alternatively, if guessing the type would be too difficult, since some object types can be very complex, enhancing the property with an additional key could make it easier and enable the useage of interfaces and named types:
This 2nd approach would also .
Here the tsType would be used for the gen.d.ts file and removed in the js transformation as it's not needed anymore.
It's not often that i need to use these property types but when I do, it's follow by unnessecary assertion of types.