Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 9c3c818

Browse files
authored
Merge pull request #11 from dubisdev/migrate-typescript
Migrate to Typescript
2 parents 097a015 + 99879ac commit 9c3c818

File tree

19 files changed

+327
-140
lines changed

19 files changed

+327
-140
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/node_modules
2-
testing.js
32
/dist

.npmignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
testing.js
2-
1+
# Project & repo actions files
32
/core
4-
esbuild.js
3+
/.github
4+
.gitignore
5+
6+
# Config files
7+
/node_modules
8+
tsconfig.json

core/client_modules/project.js

Lines changed: 0 additions & 49 deletions
This file was deleted.

core/resources/Project.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

core/resources/Section.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

core/resources/Task.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

core/resources/index.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

package.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
{
22
"name": "todoist-rest-client",
3-
"version": "1.0.0",
3+
"version": "2.0.0",
44
"description": "A simple todoist-rest-api client",
5-
"main": "core/index.js",
5+
"author": "Dubisdev",
6+
"license": "MIT",
7+
"main": "dist/index.js",
68
"type": "module",
9+
"types": "dist/index.d.ts",
710
"keywords": [
811
"todoist",
912
"rest-client"
1013
],
11-
"author": "Dubisdev",
12-
"license": "MIT",
1314

1415
"dependencies": {
1516
"axios": "^0.23.0"
1617
},
18+
"devDependencies": {
19+
"typescript": "^4.4.4"
20+
},
21+
22+
"scripts": {
23+
"prepublish": "tsc"
24+
},
25+
1726
"repository": {
1827
"type": "git",
1928
"url": "git+https://github.com/dubisdev/todoist-rest-client.git"
@@ -22,5 +31,5 @@
2231
"url": "https://github.com/dubisdev/todoist-rest-client/issues"
2332
},
2433
"homepage": "https://github.com/dubisdev/todoist-rest-client#readme"
25-
34+
2635
}

src/ExternalInterfaces.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { AxiosRequestHeaders } from "axios";
2+
3+
declare interface AuthHeader extends AxiosRequestHeaders {
4+
Authorization: string;
5+
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import task from "./client_modules/task.js";
2-
import project from "./client_modules/project.js";
1+
import task from "./submodules/task.js";
2+
import project from "./submodules/project.js";
33

4-
const TDSClient = (apiToken) => {
4+
const TDSClientConstructor = (apiToken: string = ""): TDSClient => {
55
if (!apiToken) throw new Error("Missing api token");
66

77
const headers = { Authorization: `Bearer ${apiToken}` };
@@ -13,4 +13,4 @@ const TDSClient = (apiToken) => {
1313
};
1414
};
1515

16-
export default TDSClient;
16+
export default TDSClientConstructor;

0 commit comments

Comments
 (0)