sdk-for-node
sdk-for-node copied to clipboard
🐛 Bug Report: Some Classes not present in Typescript Module
👟 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
> [email protected] 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-appwrite
module):
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?
- [X] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [X] I have read the Code of Conduct
@Y4shin, thanks for raising this issue! 🙏
@Meldiron, would you be able to handle this?
Closing as this should be resolved now. Feel free to comment if it is not and I can re-open it.
https://github.com/appwrite/sdk-for-node/blob/0fac3f6cabdea457ca946040fb3ab2ac2dc6e2d2/index.d.ts#L1845-L1860