PokeAPI / pokedex-promise-v2

An easy way to use pokeapi v2 with promises in node.js
MIT License
516 stars 91 forks source link

error in typescript generator #55

Closed Joaovitorsw closed 2 years ago

Joaovitorsw commented 2 years ago

image the project gave an error in the build due to a small detail it is generating only the last non-standard files and causes the build error, making a local change it is already able to build again image

Naramsim commented 2 years ago

Can you list all the steps you have taken to reach this output? The commands?

Did you use this (https://github.com/PokeAPI/pokedex-promise-v2#development) as a reference?

C-Garza commented 2 years ago

Yeah I see the same issue actually when using npm to install the package. The type file doesn't have any reference to ListEndpointOptions because the src folder which includes that interface isn't in the dist/src folder.

I see that ListEndpointOptions does have a type included in the typings file though, so perhaps the Main.ts file should be modified to reference that one. I think modifying the methodStructure object on lines 268 and 317 to replace type: 'ListEndpointOptions' after it's included in the generatedMethod to have it be PokeAPI.ListEndpointOptions and then regenerating the index.d.ts file should fix it. Something like:

methodStructure.parameters[0].type = "PokeAPI.ListEndpointOptions";
HRKings commented 2 years ago

Hey, thanks for pointing this out! The problem is on line 74 of the TypesGenerator, it should be rootModule and not namespace, changing this should correct the issue and the structure in general