-
Notifications
You must be signed in to change notification settings - Fork 66
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
Comments
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
<#212 (comment)>,
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? |
Just checked the closed issues - #73 (comment)
|
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:
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. 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. |
You are everything open source stands for |
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 |
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. |
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 documentationSolution
We currently use
npm i amadeus --save
to install the SDK. Adding something likenpm i --save-dev @types/amadeus
would be amazingThe text was updated successfully, but these errors were encountered: