Skip to content
Discussion options

You must be logged in to vote

I dug into the actual exports to see if there's a lower entry point than the full assertion chain, and there isn't really one, attest(value).type.toString.unwrap() already is the minimal supported path for this.

Everything under .type is powered by getTypeAssertionsAtPosition (exported from @ark/attest's cache/getCachedAssertions), which is keyed by source position, not by the runtime value. setup() runs a TypeScript Language Service pass over the whole file once, resolves the type at every attest(...) call site, and caches it (writeAssertionData at teardown). When you read .type.toString, it just looks up the cache entry for the position caller() captured at the moment you invoked attest.…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jraoult
Comment options

Answer selected by jraoult
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants