1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

Allow importing of the compiled in typescript

Fixes #18.
This commit is contained in:
Ryan Dahl 2018-05-30 18:47:26 +02:00
parent 4f00218d6d
commit 0162eca15f
4 changed files with 9 additions and 1 deletions

View file

@ -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/

View file

@ -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 {
@ -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);
}

3
testdata/import_typescript.ts vendored Normal file
View file

@ -0,0 +1,3 @@
import * as ts from "typescript";
console.log("typescript version", ts.version);

1
testdata/import_typescript.ts.out vendored Normal file
View file

@ -0,0 +1 @@
typescript version 2.8.3