From e948544b59cdd357bc76bacf4ff1f5197c4001a7 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 29 Dec 2020 14:50:33 +1000 Subject: [PATCH] use local strategy for Svelte on CI Allows some type errors to surface that were only being picked up on Windows. The root cause seems to be TypeScript picking up other .d.ts/.tsx files in the same folder, which it can only do on Windows due to the lack of sandboxing. On other platforms the other files can't be found, and tsc changes the types into 'any'. I experimented with modifying rules_svelte to build all .tsx files up front and convert them to .d.ts in bulk, but ran into further issues with conflicting types, as the typings in svelte2tsx seem to conflict with Svelte's built-in types, and passing the dependencies in explicitly causes them to be checked even though --skipLibCheck is passed in to TypeScript. Forcing sandboxing off is an ugly hack, and our best approach moving forward may be to switch to ts_project for the Svelte generation - it does appear that rules_nodejs favours it over ts_library anyway. --- .bazelrc | 6 ++++++ ts/graphs/GraphsPage.svelte | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index 8718efc26..ec5ea5684 100644 --- a/.bazelrc +++ b/.bazelrc @@ -28,4 +28,10 @@ build --incompatible_default_to_explicit_init_py build:ci --show_timestamps --isatty=0 --color=yes --show_progress_rate_limit=5 +# the typescript generation hack in rules_svelte is not hermetic, and +# converts declared types in props to 'any' if it's not run locally. +# Fixing it properly will probably require moving the Svelete rules to +# ts_project() +build:ci --strategy Svelte=local + try-import %workspace%/user.bazelrc diff --git a/ts/graphs/GraphsPage.svelte b/ts/graphs/GraphsPage.svelte index 1eaa9cac4..d01c33175 100644 --- a/ts/graphs/GraphsPage.svelte +++ b/ts/graphs/GraphsPage.svelte @@ -1,5 +1,4 @@