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

타입스크립트 지원을 위한 타입 명시 #28

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions @types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
declare module 'comcigan-parser' {
interface Option {
maxGrade?: number;
cache?: number;
}

interface SchoolSearchResult {
_: number;
region: string;
name: string;
code: number;
}

interface TimetableData {
[grade: number]: {
[classNumber: number]: {
[day: number]: ClassPeriod[];
}
}
}

interface ClassPeriod {
grade: number;
class: number;
weekday: number;
weekdayString: string;
classTime: number;
teacher: string;
subject: string;
}

class Timetable {
constructor();

init(option?: Option): Promise<void>;
search(keyword: string): Promise<Array<SchoolSearchResult>>;
setSchool(schoolCode: number): void;
getTimetable(): Promise<TimetableData>;
getClassTime(): Promise<String[]>;
}

export = Timetable;
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "Parse timetable data from comcigan.com",
"main": "index.js",
"types": "@types/index.d.ts",
"scripts": {
"test": "node ./sample/sample.js",
"standard": "standard && node my-tests.js"
Expand All @@ -25,7 +26,8 @@
"dependencies": {
"cheerio": "^1.0.0-rc.5",
"iconv-lite": "^0.4.24",
"request": "^2.88.0"
"request": "^2.88.0",
"typescript": "^5.3.3"
},
"devDependencies": {
"standard": "^12.0.1"
Expand Down