Skip to content
Discussion options

You must be logged in to vote

import type never leaked in anything I tested. But "use import type instead of import { type X }" is not the whole rule. With verbatimModuleSyntax: true, a value import that you only use in a type position still leaks, for example import { getAuth } from './auth' used only as ReturnType<typeof getAuth>. tsc doesn't report it, and the Start/Router compilers don't always remove it. Whether import { type X } leaks also depends on whether one of those compilers rewrote the importing file.

I checked this with a real build instead of reasoning about the transforms. I made a small Start app where every "server" module has a top-level side effect containing a unique string. Each module is importe…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by aaditmshah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants