Skip to content

Commit

Permalink
Merge pull request #8 from microsoft/map-next-to-latest-ts-version
Browse files Browse the repository at this point in the history
Map "next" to latest TS version
  • Loading branch information
andrewbranch authored Apr 28, 2020
2 parents 78bf0be + f62f726 commit a6b458a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/utils/src/typescript-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function typeScriptPath(version: TsVersion, tsLocal: string | undefined):

function installDir(version: TsVersion): string {
assert(version !== "local");
if (version === "next") version = TypeScriptVersion.latest;
return path.join(installsDir, version);
}

Expand Down
17 changes: 17 additions & 0 deletions packages/utils/test/typescript-installer.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { typeScriptPath } from "../src/typescript-installer";
import { TypeScriptVersion } from "@definitelytyped/typescript-versions";
import * as os from "os";
import * as path from "path";

describe("typeScriptPath", () => {
it("maps to temp folder", () => {
expect(typeScriptPath("3.4", undefined)).toEqual(
path.join(os.homedir(), ".dts", "typescript-installs", "3.4", "node_modules", "typescript")
);
});
it("maps next to latest typescript version", () => {
expect(typeScriptPath("next", undefined)).toEqual(
path.join(os.homedir(), ".dts", "typescript-installs", TypeScriptVersion.latest, "node_modules", "typescript")
);
});
});

0 comments on commit a6b458a

Please sign in to comment.