Use void instead of undefined in instance API - #1417
Merged
Conversation
Collaborator
|
thanks! |
tslil-topos
added a commit
that referenced
this pull request
Aug 24, 2026
* OBEE-36: add instance types and validation
Define instance, table, and error types as well as add runtime support for instance-capable shapes. Add temporary implementations of atomic column typing and instance validation until we decide how we want this to work mathematically. We do not add capability to actually generate anything of these types in this change.
Adjust the pnpm config to build generated document types before checking (we now depend on catlog-wasm) and increase the validation test timeout for loading catlog-wasm.
This change includes the revised interface for instances and usage pattern that Kaspar and i had discussed. See `src/instance/instance.ts` for details.
In order to obtain `tables` for example, the expected pattern is
```typescript
// subscribe to validation
const unsubscribe = instance.onValidate(async (validation) => {
// ignore invalid schemas or instances
if (validation.tag !== "Ok") return;
// both were valid at the callback time, try to read the table content
const result = await instance.tables();
// something invalidated either the schema or instance
if (result.tag !== "Ok") return;
// use tables...
const tables = result.content;
});
// finally
unsubscribe();
```
* ENH: Use void instead of undefined in instance API (#1417)
---------
Co-authored-by: tslil-topos <tslil@topos.institute>
Co-authored-by: Kaspar <git@kaspar.systems>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.