Open AsPulse opened 2 years ago
Hey @AsPulse. I just tried your example in #398, but I get a different result to what you're saying here. https://stackblitz.com/edit/node-atzfxo?file=src/index.runtypes.ts Can you provide me with a full example?
Sorry, I checked and it seems that the problem only occurs when importing a Type containing Generics from another file (external.ts in the example below).
https://stackblitz.com/edit/node-ahtzsa?file=src/external.ts
So, finally got around to having a look at this. The problem boils down to a bug when importing types from other files. It's a toughy, and I'll get around to it soon. In the mean time, if at all possible, the work around is to specify the source file of the type you're trying to build.
Instead of:
- targetFile: ./src/index.runtypes.ts
sourceTypes:
- file: ./src/index.ts
type: [Foo]
Use:
- targetFile: ./src/index.runtypes.ts
sourceTypes:
- file: ./src/external.ts
type: [Bar]
Generated:
I don't think the bottom part is necessary and gills in my opinion. Is it necessary for some generative process...?
<{ data: string; } extends any, > ({ data: string; }: Runtype<{ data: string; }>,) =>