Fix Slow Types Warning When Publishing to JSR?

Does anybody know how to fix the slow types warning when exporting an arktype type validator in a JSR package?
error[missing-explicit-type]: missing explicit type in the public API
--> /home/zicklag/git/muni-town/leaf/packages/leaf/sync-proto.ts:142:14
|
142 | export const clientMessage = type({
| ^^^^^^^^^^^^^ this symbol is missing an explicit type
|
= hint: add an explicit type annotation to the symbol

info: all symbols in the public API must have an explicit type
docs: https://jsr.io/go/slow-type-missing-explicit-type
error[missing-explicit-type]: missing explicit type in the public API
--> /home/zicklag/git/muni-town/leaf/packages/leaf/sync-proto.ts:142:14
|
142 | export const clientMessage = type({
| ^^^^^^^^^^^^^ this symbol is missing an explicit type
|
= hint: add an explicit type annotation to the symbol

info: all symbols in the public API must have an explicit type
docs: https://jsr.io/go/slow-type-missing-explicit-type
I'm not exactly sure how to add an explicit type for my Arktype types. I'm guessing it's not exactly possible to add an explicit type that satisfies the fast type checking that JSR is looking for, but I wanted to make sure.
5 Replies
ssalbdivad
ssalbdivad6d ago
You can add a type annotation like const clientMessage: Type<...> but you'd be duplicating your types I really dislike slow types as a concept and am fairly convinced just publishing js + .d.ts is better Even within ArkType, it disallows really useful constructs like this for allowing global configuration: https://arktype.io/docs/configuration#prototypes And there's nothing I can do to work around so people consuming arktype through JSR would just get a worse experience than people consuming it through npm (or generally .d.ts)
Zicklag
ZicklagOP6d ago
Oh, interesting, I was assuming it was some mechanism to more easily generate .d.ts files. I don't really know how it works. Well, for now I'm fine just allowing it.
ssalbdivad
ssalbdivad6d ago
That is kind of what it is but there are a lot of cases where you'd want more control over your .d.ts output and it just blocks useful features of TS like I mentioned so it really needs to be reconsidered
Zicklag
ZicklagOP6d ago
Maybe there'll be less of a concern once the go TS implementation comes and makes everything faster.
ssalbdivad
ssalbdivad6d ago
Ehh it has more to do with the actual logic of how they're generating the .d.ts than whats actually slow

Did you find this page helpful?