Skip to content

Commit d6e4884

Browse files
committed
type to interfaces
1 parent 6d2e6f2 commit d6e4884

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/tasks/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import * as path from 'path'
55

66
import RunScenario from './run'
77
import SubmissionScenario from './submission'
8-
import { RunJob, SubmitJob } from "./job";
8+
import { RunJob, SubmitJob, Job } from "./job";
99

1010
export function execute(job: RunJob): Promise<RunResult>
1111
export function execute(job: SubmitJob): Promise<SubmissionResult>
12-
export async function execute (job) {
12+
export async function execute (job: Job) {
1313
// Create RUNBOX
1414
rm('-rf', config.RUNBOX.DIR)
1515
mkdir('-p', config.RUNBOX.DIR)

src/tasks/job.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
type JobConstructorOpts = {
1+
interface JobConstructorOpts {
22
id: number
33
source: string
44
lang: string
55
timelimit?: number
66
}
7-
type RunJobConstructorOpts = JobConstructorOpts & {
7+
interface RunJobConstructorOpts extends JobConstructorOpts {
88
stdin: string
99
}
10-
type TestcaseOpts = {
10+
interface TestcaseOpts {
1111
id: number,
1212
input: string,
1313
output: string
1414
}
15-
type SubmitJobConstructorOpts = JobConstructorOpts & {
15+
interface SubmitJobConstructorOpts extends JobConstructorOpts {
1616
testcases: Array<TestcaseOpts>
1717
}
1818

src/types/result.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
export type Result = {
1+
export interface Result {
22
id: number,
33
stderr: string
44
}
55

6-
export type TestcaseResult = {
6+
export interface TestcaseResult {
77
id: number,
88
score: number,
99
time: string,
1010
result: string
1111
}
1212

13-
export type RunResult = Result & {
13+
export interface RunResult extends Result {
1414
stdout: string,
1515
time: number,
1616
code: number
1717
}
1818

19-
export type SubmissionResult = Result & {
19+
export interface SubmissionResult extends Result {
2020
testcases: Array<TestcaseResult>
2121
}

0 commit comments

Comments
 (0)