A
arktype2mo ago
Eric

arktype with isolatedDeclarations

If you have a package that uses arktype and isolatedDeclarations: true in tsconfig.json (for speed, OXC/tsdown support), then you'll likely see this error:
RollupError: TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
x TS9010: Variable must have an explicit type annotation with
| --isolatedDeclarations.
,-[/Users/eric/Projects/testdriverai/monorepo/packages/sdk/src/types.ts:7:14]
6 |
7 | export const $ = type.scope({
RollupError: TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
x TS9010: Variable must have an explicit type annotation with
| --isolatedDeclarations.
,-[/Users/eric/Projects/testdriverai/monorepo/packages/sdk/src/types.ts:7:14]
6 |
7 | export const $ = type.scope({
Is there a way to explicitly provide a return type annotation without redeclaring the whole thing?
7 Replies
ssalbdivad
ssalbdivad2mo ago
No, you'll run into this problem with any library with schema inference. It's inherently in conflict with isolatedDeclarations, which is why I don't recommend that setting unless you're a really large project with very few dependencies that rely on inference and have a ton of tolerance for repetitive declarations to help somewhat improve compilation speed.
Eric
EricOP2mo ago
Good to know. You’re right. Didn’t know if there was a “simple” answer. There probably is one, and that’s to use tsup or zshy in Arktype projects, not tsdown 😅
ssalbdivad
ssalbdivad2mo ago
I'm sitting next to Colin right now he recommends zshy 👍
Eric
EricOP2mo ago
lol, I have both - I needed to inline some private packages which means ✨ bundle ✨ Tell Colin I said hi! And that turbo watch build should close a few open issues 🙏 Where you at? Some coffee shop someplace? Wait, hang on. OR Did he come to your place because of all the snarky Zod tweets you made!?
ssalbdivad
ssalbdivad2mo ago
Yeah it's a beatdown
ssalbdivad
ssalbdivad2mo ago
We are at Squiggle Conf https://squiggleconf.com/
SquiggleConf 2025 | Supercharging web devs and their tools
A Boston conference for excellent web dev tooling.
Eric
EricOP2mo ago
Oh, cool! I've yet to go. Money's tight af here 🙁

Did you find this page helpful?