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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: Some Classes not present in Typescript Module #37

Closed
2 tasks done
Y4shin opened this issue Sep 16, 2022 · 2 comments
Closed
2 tasks done

馃悰 Bug Report: Some Classes not present in Typescript Module #37

Y4shin opened this issue Sep 16, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Y4shin
Copy link

Y4shin commented Sep 16, 2022

馃憻 Reproduction steps

Installing the Node SDK, importing the Permission and/or Role class and compiling with tsc.

Import Statement

import sdk, {Permission, Role} from 'node-appwrite';

package.json

{
	"name": "appwrite-function",
	"version": "1.0.0",
	"description": "",
	"main": "src/index.js",
	"scripts": {
		"test": "echo \"Error: no test specified\" && exit 1",
		"build": "npx tsc"
	},
	"keywords": [],
	"author": "",
	"license": "ISC",
	"dependencies": {
		"node-appwrite": "^8.0.0",
		"typescript": "^4.8.3"
	}
}

馃憤 Expected behavior

Import the classes.

馃憥 Actual Behavior

Raises an error for each of the two classes during Typescript Compilation:

user@host someFolder % npm run build

> appwrite-function@1.0.0 build
> npx tsc

src/index.ts:1:14 - error TS2305: Module '"node-appwrite"' has no exported member 'Permission'.

1 import sdk, {Permission, Role} from 'node-appwrite';
               ~~~~~~~~~~

src/index.ts:1:26 - error TS2305: Module '"node-appwrite"' has no exported member 'Role'.

1 import sdk, {Permission, Role} from 'node-appwrite';
                           ~~~~


Found 2 errors in the same file, starting at: src/index.ts:1

The error does not appear, when manually adding these Lines into the index.d.ts file after line 1719 (into the root namespace of the node-appwritemodule):

export class Permission {
    static read(role: string): string;
    static write(role: string): string;
    static create(role: string): string;
    static update(role: string): string;
    static delete(role: string): string;
  }
  export class Role {
    static any(): string;
    static user(id: string, status?: string): string;
    static users(status?: string): string;
    static guests(): string;
    static team(id, role?: string): string;
    static member(id): string;
    static status(status: string): string;
  }

馃幉 Appwrite version

Different version (specify in environment)

馃捇 Operating system

Linux

馃П Your Environment

Appwrite Version: 1.0.1
node-appwrite Version: ^8.0.0
tsc Version: 4.8.3

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@Y4shin Y4shin added the bug Something isn't working label Sep 16, 2022
@stnguyen90
Copy link
Contributor

@Y4shin, thanks for raising this issue! 馃檹

@Meldiron, would you be able to handle this?

@stnguyen90
Copy link
Contributor

Closing as this should be resolved now. Feel free to comment if it is not and I can re-open it.

sdk-for-node/index.d.ts

Lines 1845 to 1860 in 0fac3f6

export class Permission {
static read(role: string): string;
static write(role: string): string;
static create(role: string): string;
static update(role: string): string;
static delete(role: string): string;
}
export class Role {
static any(): string;
static user(id: string, status?: string): string;
static users(status?: string): string;
static guests(): string;
static team(id: string, role?: string): string;
static member(id: string): string;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants