Add Typescript support to Node SDK
Description
Add typescript support to Node SDK.
Reason
Currently the Node SDK has 0 type support and make developer experience tough when building an app with typescript and trying to use the SDK
it would be nice to be able to see what an expected response would be in the code editor. This also causes responses to be typed as any which isnt quite right since we can see the types in the documentation
Solution
We currently use npm i amadeus --save to install the SDK. Adding something like npm i --save-dev @types/amadeus would be amazing
I see there's no response for this, but it's really needed
second this, would help a lot.
or at least provide declaration files so that we get autocomplete in VS Code
Okay let me check, on my side i just added the .d.ts file, but i still get the responses with no types defaulted to type any
On Fri, Aug 2, 2024 at 11:43 PM Antoine Weber @.***> wrote:
clone this repo
run tsc --declaration --allowJs --emitDeclarationOnly --outDir .@.*** src/**/*.js now you have a directory called @types with 2 items in it
now go to your personal project, open the node_modules, look for the @types directory
drop the 2 items from you generated before into this directory
now it works automatically
— Reply to this email directly, view it on GitHub https://github.com/amadeus4dev/amadeus-node/issues/212#issuecomment-2266121398, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASNBD6NLKNNPEVHX2KXNYTDZPPVO5AVCNFSM6AAAAABFA3ZEACVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRWGEZDCMZZHA . You are receiving this because you commented.Message ID: @.***>
Yeah, the developer experience is not great with the Node SDK... I'd rather use the REST API than this typeless library
It's odd though, all this JSDoc in the files you'd think there'd be some level of decent typing? Zero autocomplete in my code editor is absolutely a deal breaker for me.
Just checked the closed issues - https://github.com/amadeus4dev/amadeus-node/issues/73#issuecomment-1233963555
This repository is not based on Typescript. For that reason, we are going to close this issue.
⁉️
they use babel before publishing the package on npm, and they don't include the src directory.
but if you clone this repository, you have access to the src directory, and you can the following command on it, to generate declaration files, from the JS source code:
tsc --declaration --allowJs --emitDeclarationOnly --outDir ./@types src/**/*.js
You then need to do some shenanigans to import this to your project. I managed it myself, but it's a bit cumbersome
I'm sorry for the notifications, the indications I posted before seem to have an issue.
I won't post again before i'm 100% sure I understand how to reproduce.
The only way i have it to work is to drop it in the node_modules/@types directory but this gets deleted everytime we npm install something, so it's not worth making a guide.
There really should be a fork of this by now that has this issue solved, seems like this is a problem going for 2 years now
I have created amadeus-ts package. I rewrote the entire codebase in TypeScript, and so far I have added types for the most commonly used endpoint which is flight offers search and flight offers pricing. The package is stable but still under development, and I'm trying to add new types for the remaining endpoints each day.
I Have tested the library and it works perfectly fine apart from the incomplete types for the remaining endpoints that I'm currently working on. Please test the library and if you find any issues please submit them in the GitHub repository and any PRs are welcome as well.
The package amadeus-ts is complete. It includes types for all endpoints now.
The package amadeus-ts is complete. It includes types for all endpoints now.
You are everything open source stands for Thank you 🫡
The package amadeus-ts is complete. It includes types for all endpoints now.
You are everything open source stands for Thank you 🫡
You're welcome, I'm glad I was able to help.
Catching up on this thread and seeing there is a need for a TypeScript SDK provided by Amadeus. Happy to work with the Amadeus team to build an officially supported SDK, that would help developers with faster time to integration. This would also remove the burden/risk of requiring the community to maintain an SDK that is constantly evolving.
For reference, we recently worked with Mistral to build their TS SDK: https://github.com/mistralai/client-ts