Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Added typescript type declarations & typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
dvlkv committed Feb 21, 2021
1 parent 9962d30 commit 4406e5c
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 56 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ module.exports = {
sourceType: 'module'
},
rules: {
}
},
ignorePatterns: ['*.d.ts']
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Jetbrains IDE
.idea/
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@
"main": "src/index.js",
"author": "Seia-Soto <[email protected]>",
"license": "MIT",
"types": "src/index.d.ts",
"scripts": {
"example": "node example",
"profile": "node scripts/profile"
},
"devDependencies": {
"@types/node-fetch": "^2.5.8",
"babel-eslint": "^10.1.0",
"eslint": "^7.19.0",
"eslint-config-standard": "^16.0.2",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1"
"eslint-plugin-promise": "^4.3.1",
"typescript": "^4.1.5"
},
"dependencies": {
"debug": "^4.3.1",
Expand Down
2 changes: 2 additions & 0 deletions src/api/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare var content: any;
export = content;
16 changes: 16 additions & 0 deletions src/profiles/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
type Locale = { languages: string, locale: string, acceptLanguages: string }
type Application = {
apiRoot: string;
userAgnet: string;
userAgentStatic: string;
appVersion: string;
appBuild: string;
agoraKey: string;
pubnubRoot: string;
pubnubPubKey: string;
pubnubSubKey: string;
pubnubSDK: string;
}

export declare const application: { a297: Application, a304: Application };
export declare const locales: { English: Locale, Korean: Locale };
3 changes: 3 additions & 0 deletions src/structures/agent.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import fetch from "node-fetch";

export default function agent(url: string, options: any, customs: any): ReturnType<typeof fetch>;
7 changes: 7 additions & 0 deletions src/structures/client.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type ClubhouseApiResult<T> = ({ success: true } & T) |
{ success: false, error_message: string };

export declare class Client {
constructor(params: { profile: any });
[k: string]: <T>(...params: any) => Promise<ClubhouseApiResult<T>>;
}
4 changes: 4 additions & 0 deletions src/structures/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Client as client } from './client';
import agent from './agent';

export { client, agent };
Loading

0 comments on commit 4406e5c

Please sign in to comment.