From 89190ab1ff695a1ba1e373933c03c12c0cc750a8 Mon Sep 17 00:00:00 2001 From: Timon Stampfli Date: Tue, 29 Oct 2019 16:27:06 +0100 Subject: [PATCH] annotating types --- src/util.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/util.ts b/src/util.ts index 9e823c7..142f6d3 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,11 +1,12 @@ import * as vscode from "vscode"; -export function toSortedKeys(map: Map): string[] { - // Todo can I ignore the map value type in a better way +type platform = "darwin-amd64" | "windows-amd64" | "linux-amd64"; + +export function toSortedKeys(map: Map): string[] { return Array.from(map.keys()).sort(); } -export function executableFileEnding() { +export function executableFileEnding(): "" | ".exe" | never { if (determinePlatform() === "windows-amd64") { return ".exe"; } else { @@ -13,7 +14,7 @@ export function executableFileEnding() { } } -export function determinePlatform() { +export function determinePlatform(): platform { // also look at process.arch switch (process.platform) { case "darwin": -- GitLab