From bdbbbcb777811ecafc1cdf9c37d48d6c38aefe91 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 6 Aug 2020 09:31:53 -0700 Subject: [PATCH] Add explanation --- site/content/faq/500-what-about-typescript-support.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/site/content/faq/500-what-about-typescript-support.md b/site/content/faq/500-what-about-typescript-support.md index be0825215b..98838bab3d 100644 --- a/site/content/faq/500-what-about-typescript-support.md +++ b/site/content/faq/500-what-about-typescript-support.md @@ -11,8 +11,10 @@ let x: number; $: x = count + 1; ``` -To `import` a type or interface make sure to use [TypeScript's `type` modifier](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export): +To import a type or interface make sure to use [TypeScript's `type` modifier](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export): ``` import type { SomeInterface } from './SomeFile'; ``` + +You must use the `type` modifier because `svelte-preprocess` doesn't know whether an import is a type or a value — it only transpiles one file at a time without knowledge of the other files and therefore can't safely erase imports which only contain types without this modifier present.