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 types declaration in JS SDK #34

Merged
merged 1 commit into from
Apr 18, 2020
Merged

Conversation

mng1dev
Copy link

@mng1dev mng1dev commented Apr 10, 2020

This PR is to use the JS SDK in a TypeScript project by creating a types declaration file in the JS language itself, instead of creating a dedicated TS SDK.

Should help to solve #20

@eldadfux
Copy link
Member

Thanks for the PR, is there any way I can validate the changes? How can I check it with my VS code? Do I need any plugin?

@mng1dev
Copy link
Author

mng1dev commented Apr 13, 2020

Hi @eldadfux ,

I have followed this guide from Microsoft, in particular how to port a UMD library that create instances of a class.

To check if it works, you can:

  • Compile the sdk
  • Create a blank typescript project
  • Add a local dependency to your package.json file: "appwrite": "file:/path/to/js/sdk",
  • Test the SDK

Example of import:

import Appwrite from 'appwrite';
export default class TestAppwrite {

  public static client = new Appwrite().setEndpoint('endpoint').setProject('project_id')

  public static addUser(email: string, password: string, name: string) {
    TestAppwrite.client.account.create(email, password, name)
  }

}

@eldadfux eldadfux merged commit fc0847c into appwrite:master Apr 18, 2020
@eldadfux
Copy link
Member

THANK YOU! All changes merged 🥳

Please reach out to me on our Discord server if you would like me to send you some cool Appwrite stickers and magnets! (Might take a lot of time for shipping because of the global lockdown)

As a way of saying thank you, we have just invited you to join the Appwrite organization on GitHub. You can accept the invite by visiting https://github.com/orgs/appwrite/invitation. By joining our team, you will officially be an Appwrite maintainer on GitHub.

You can change your membership visibility settings, so your new Appwrite team membership badge will show up on your personal GitHub profile.

@eldadfux
Copy link
Member

@zevektor, added some minor updates and deployed a demo version here:
https://github.com/aw-tests/sdk-for-js

@eldadfux
Copy link
Member

@zevektor this is now live in Appwrite 0.6: https://dev.to/eldadfux/appwrite-0-6-comes-with-full-typescript-support-2ff2 Thank you so much! ❤️

@eldadfux
Copy link
Member

image

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

Successfully merging this pull request may close these issues.

2 participants