Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Typescript support to Node SDK #212

Open
WillGarman opened this issue Mar 21, 2024 · 14 comments
Open

Add Typescript support to Node SDK #212

WillGarman opened this issue Mar 21, 2024 · 14 comments

Comments

@WillGarman
Copy link

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

image

Solution

We currently use npm i amadeus --save to install the SDK. Adding something like npm i --save-dev @types/amadeus would be amazing

@marenga14
Copy link

I see there's no response for this, but it's really needed

@slk333
Copy link

slk333 commented Aug 1, 2024

second this, would help a lot.

or at least provide declaration files so that we get autocomplete in VS Code

@marenga14
Copy link

marenga14 commented Aug 3, 2024 via email

@bedros-p
Copy link

bedros-p commented Aug 5, 2024

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.

@bedros-p
Copy link

bedros-p commented Aug 5, 2024

Just checked the closed issues - #73 (comment)

This repository is not based on Typescript.
For that reason, we are going to close this issue.

⁉️

@slk333
Copy link

slk333 commented Aug 5, 2024

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

@slk333
Copy link

slk333 commented Aug 5, 2024

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.

@bedros-p
Copy link

bedros-p commented Aug 5, 2024

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

@darseen
Copy link
Contributor

darseen commented Aug 12, 2024

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.

@darseen
Copy link
Contributor

darseen commented Aug 25, 2024

The package amadeus-ts is complete. It includes types for all endpoints now.

@bedros-p
Copy link

The package amadeus-ts is complete. It includes types for all endpoints now.

You are everything open source stands for
Thank you 🫡

@darseen
Copy link
Contributor

darseen commented Aug 25, 2024

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.

@mp0707
Copy link

mp0707 commented Aug 30, 2024

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

@olle-johannesson
Copy link

Perhaps the most low-impact way would be to autogenerate the types from JSDoc on the top-level API of the package and publish it to DefinitelyTyped. Add a git hook to check the JSDoc, and this should be a sufficient first step, and then we can work from there.

Changing the programming language of a project is a significant decision, so it’s no surprise if @darseen’s wonderful contribution is met with insufficient enthusiasm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants