summaryrefslogtreecommitdiff
path: root/js/compiler.ts
diff options
context:
space:
mode:
authorDaniel Ramos <danielramosacosta@hotmail.com>2018-09-07 20:25:25 +0100
committerRyan Dahl <ry@tinyclouds.org>2018-09-09 10:51:15 -0400
commitb7ebc1b69940906966e620424281dbb8f3cf8abd (patch)
treecf9cec4b3916bea06fa2bdad7277b3f20a8226cc /js/compiler.ts
parent9b052ace09a47f14cd59eaf8734a5e6cb1b7e5b8 (diff)
Add type aliases for sourceCode and outputCode
Diffstat (limited to 'js/compiler.ts')
-rw-r--r--js/compiler.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/js/compiler.ts b/js/compiler.ts
index e5632341d..fdce8c2ed 100644
--- a/js/compiler.ts
+++ b/js/compiler.ts
@@ -51,6 +51,10 @@ type ModuleSpecifier = string;
* The compiled source code which is cached in `.deno/gen/`
*/
type OutputCode = string;
+/**
+ * The original source code
+ */
+type SourceCode = string;
/**
* Abstraction of the APIs required from the `os` module so they can be
@@ -91,8 +95,8 @@ export class ModuleMetaData implements ts.IScriptSnapshot {
constructor(
public readonly moduleId: ModuleId,
public readonly fileName: ModuleFileName,
- public readonly sourceCode = "",
- public outputCode = ""
+ public readonly sourceCode: SourceCode = "",
+ public outputCode: OutputCode = ""
) {
if (outputCode !== "" || fileName.endsWith(".d.ts")) {
this.scriptVersion = "1";
@@ -511,8 +515,8 @@ export class DenoCompiler
return this._moduleMetaDataMap.get(fileName)!;
}
let moduleId: ModuleId = "";
- let sourceCode: string | undefined;
- let outputCode: string | undefined;
+ let sourceCode: SourceCode | undefined;
+ let outputCode: OutputCode | undefined;
if (
moduleSpecifier.startsWith(ASSETS) ||
containingFile.startsWith(ASSETS)