Skip to content

Commit

Permalink
Add type to compile function
Browse files Browse the repository at this point in the history
  • Loading branch information
ivogabe committed Apr 11, 2016
1 parent 335cac3 commit 771207b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
12 changes: 8 additions & 4 deletions lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ class CompileOutputStream extends stream.Readable {
}
}

function compile();
function compile(proj: project.Project, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter);
function compile(settings: compile.Settings, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter);
function compile(param?: any, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): any {
function compile(): compile.CompileStream;
function compile(proj: project.Project, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): compile.CompileStream;
function compile(settings: compile.Settings, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): compile.CompileStream;
function compile(param?: any, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): compile.CompileStream {
let proj: project.Project;
if (param instanceof project.Project) {
proj = param;
Expand Down Expand Up @@ -229,6 +229,10 @@ function getCompilerOptions(settings: compile.Settings, projectPath: string): ts
}

module compile {
export interface CompileStream extends stream.Readable {
js: stream.Readable;
dts: stream.Readable;
}
export interface Settings {
out?: string;
outFile?: string;
Expand Down
11 changes: 8 additions & 3 deletions release/main.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import * as ts from 'typescript';
import * as stream from 'stream';
import * as project from './project';
import * as _reporter from './reporter';
declare function compile(): any;
declare function compile(proj: project.Project, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): any;
declare function compile(settings: compile.Settings, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): any;
declare function compile(): compile.CompileStream;
declare function compile(proj: project.Project, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): compile.CompileStream;
declare function compile(settings: compile.Settings, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): compile.CompileStream;
declare module compile {
interface CompileStream extends stream.Readable {
js: stream.Readable;
dts: stream.Readable;
}
interface Settings {
out?: string;
outFile?: string;
Expand Down

0 comments on commit 771207b

Please sign in to comment.