aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/tsc-vimgrep.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/tsc-vimgrep.sh b/scripts/tsc-vimgrep.sh
new file mode 100755
index 0000000..1db2013
--- /dev/null
+++ b/scripts/tsc-vimgrep.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env sh
+
+set -e -o pipefail
+
+path="$1"
+
+args="--noEmit --pretty false"
+if [ -d "$path" ]; then
+ args="$args -p $path"
+elif [ -z "$path" ]; then
+ args="$args -p ."
+else
+ args="$args $path"
+fi
+
+tsc="npx tsc"
+if [ -f ./node_modules/.bin/tsc ]; then
+ tsc="./node_modules/.bin/tsc";
+fi
+
+echo "running "$tsc" $args"
+"$tsc" $args | sed -E 's/^([^(]+)\(([0-9]+),([0-9]+)\)\s*:\s*(.*)$/\1:\2:\3: \4/' || (echo "exited with $?"; exit $?)
+echo "done"