Skip to content

Commit

Permalink
Fix compile and bundle api types (denoland#3703)
Browse files Browse the repository at this point in the history
  • Loading branch information
klaushvam authored and ry committed Jan 17, 2020
1 parent aedf872 commit 35eb796
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions cli/js/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,10 @@ self.compilerMain = function compilerMain(): void {
emitResult.emitSkipped === false,
"Unexpected skip of the emit."
);
const { items } = fromTypeScriptDiagnostic(diagnostics);
const result = [
items && items.length ? items : undefined,
diagnostics.length
? fromTypeScriptDiagnostic(diagnostics)
: undefined,
bundle ? state.emitBundle : state.emitMap
];
postMessage(result);
Expand Down
4 changes: 2 additions & 2 deletions cli/js/compiler_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export function compile(
rootName: string,
sources?: Record<string, string>,
options?: CompilerOptions
): Promise<[Diagnostic[] | undefined, Record<string, string>]> {
): Promise<[Diagnostic | undefined, Record<string, string>]> {
const payload = {
rootName: sources ? rootName : checkRelative(rootName),
sources,
Expand Down Expand Up @@ -377,7 +377,7 @@ export function bundle(
rootName: string,
sources?: Record<string, string>,
options?: CompilerOptions
): Promise<[Diagnostic[] | undefined, string]> {
): Promise<[Diagnostic | undefined, string]> {
const payload = {
rootName: sources ? rootName : checkRelative(rootName),
sources,
Expand Down
4 changes: 2 additions & 2 deletions cli/js/lib.deno_runtime.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1904,7 +1904,7 @@ declare namespace Deno {
rootName: string,
sources?: Record<string, string>,
options?: CompilerOptions
): Promise<[Diagnostic[] | undefined, Record<string, string>]>;
): Promise<[Diagnostic | undefined, Record<string, string>]>;

/** Takes a root module name, and optionally a record set of sources. Resolves
* with a single JavaScript string that is like the output of a `deno bundle`
Expand Down Expand Up @@ -1938,7 +1938,7 @@ declare namespace Deno {
rootName: string,
sources?: Record<string, string>,
options?: CompilerOptions
): Promise<[Diagnostic[] | undefined, string]>;
): Promise<[Diagnostic | undefined, string]>;

// @url js/deno.d.ts

Expand Down

0 comments on commit 35eb796

Please sign in to comment.