halfnelson / nativescript-source-to-jsx-def

Walk nativescript source to generate JSX types for `svelte-type-checker-vscode`
Other
4 stars 1 forks source link

Question about tree-shaking #2

Open shirakaba opened 4 years ago

shirakaba commented 4 years ago

I'm pretty clueless on tree-shaking, but would this type-only import possibly aid tree-shaking? Or would there be no difference due to how import() works?

Yours is a .d.ts file so it may be a totally moot point, but I'm provisionally planning to consume it as a .ts file so I'm wondering about the new TypeScript's type-only imports.

type Image = import("@nativescript/core/ui/image/image").Image;
import type { Image } from "@nativescript/core/ui/image/image";

(Caveat: NativeScript Playground, at least for the React template, doesn't use a version of TypeScript modern enough to support type-only imports yet).

halfnelson commented 4 years ago

i think typescript will do the lifting here and not include since they are type only