Skip to content

Commit

Permalink
Allow importing of the compiled in typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed May 30, 2018
1 parent 4f00218 commit 0162eca
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ deno: msg.pb.go $(GO_FILES)
go build -o deno ./cmd

assets.go: dist/main.js
cp node_modules/typescript/lib/lib.*d.ts dist/
cp node_modules/typescript/lib/*d.ts dist/
cp deno.d.ts dist/
go-bindata -pkg deno -o assets.go dist/

Expand Down
4 changes: 4 additions & 0 deletions runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ export function makeDefine(fileName: string): AmdDefine {
return localRequire;
} else if (dep === "exports") {
return localExports;
} else if (dep === "typescript") {
return ts;
} else if (dep === "deno") {
return deno;
} else {
Expand Down Expand Up @@ -310,6 +312,8 @@ class TypeScriptHost implements ts.LanguageServiceHost {
let resolvedFileName;
if (name === "deno") {
resolvedFileName = resolveModuleName("deno.d.ts", "/$asset$/");
} else if (name === "typescript") {
resolvedFileName = resolveModuleName("typescript.d.ts", "/$asset$/");
} else {
resolvedFileName = resolveModuleName(name, containingFile);
}
Expand Down
3 changes: 3 additions & 0 deletions testdata/import_typescript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as ts from "typescript";

console.log("typescript version", ts.version);
1 change: 1 addition & 0 deletions testdata/import_typescript.ts.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typescript version 2.8.3

0 comments on commit 0162eca

Please sign in to comment.