Found while bringing packages/data-objectstack/README.md under check:doc-snippet-types (#5174 batch 8). Filed rather than fixed: packages/*/src is outside that PR's surface.
What the shipped declaration says
packages/data-objectstack/dist/index.d.ts:
declare function createObjectStackAdapter<T = unknown>(config: { ... }): DataSource<T>;
DataSource is @object-ui/types' interface (packages/types/dist/data.d.ts:292). It declares find, findOne, create, update, delete, bulk, batchTransaction, getObjectSchema, aggregate and the import/export job surface — and none of the adapter-only members.
The measured consequence
Compiled against the built dist with the doc-snippet gate's own compiler options and module resolution:
import { createObjectStackAdapter } from '@object-ui/data-objectstack';
declare const dataSource: ReturnType<typeof createObjectStackAdapter>;
dataSource.getClient();
dataSource.getCacheStats();
dataSource.invalidateCache('users');
dataSource.clearCache();
TS2339 Property 'getClient' does not exist on type 'DataSource<unknown>'.
TS2339 Property 'getCacheStats' does not exist on type 'DataSource<unknown>'.
TS2339 Property 'invalidateCache' does not exist on type 'DataSource<unknown>'.
TS2339 Property 'clearCache' does not exist on type 'DataSource<unknown>'.
The same four, plus getConnectionState, isConnected, onConnectionStateChange and onBatchProgress, are exactly the members packages/data-objectstack/README.md's own API Reference — ObjectStackAdapter — Methods list documents, and that four whole README sections (Metadata Caching, Connection State Monitoring, Batch Operation Progress, Troubleshooting/Cache Issues) are built around. The declaration typing the exported ObjectStackAdapter class carries all of them; only the factory's declared return narrows them away.
So a reader who follows the README's own Basic Setup — const dataSource = createObjectStackAdapter({ baseUrl }) — and then follows any of those four sections does not compile. The runtime object has the methods; the declared type does not admit them.
Why this is a producer-side gap, not a doc bug
The methods are real, exported and documented; there is nothing to correct on the page. The cast-free escape a consumer has today is to construct the class instead (new ObjectStackAdapter(config)), which the README's own API Reference documents as public — so the two supported ways of obtaining the same object give different type surfaces.
Options
- A. Widen the factory's declared return to the adapter's own type:
createObjectStackAdapter(config): ObjectStackAdapter (or DataSource<T> and ObjectStackAdapter). One line, and it makes declared match shipped for every documented member at once. - B. Leave the narrow return and add the missing members to
DataSource. Wrong shape: caching, connection state and batch progress are this adapter's concerns, not every data source's, and every other DataSource implementation would then be declaring members it does not have. - C. Document the cast. Cheapest, and the worst of the three under the "declared = enforced" rule — it teaches a cast around a declaration that is simply narrower than the value.
Recommendation: A.
Where this shows up now
Batch 8 ships those README blocks compiling, by declaring the adapter as the exported ObjectStackAdapter class — truthful about the object, and about the one supported way to obtain that type today — and adds a short note to the README's setup section naming this card, so the page does not silently teach a shape the factory's return will reject. The note comes out when this is fixed.
Found while bringing
packages/data-objectstack/README.mdundercheck:doc-snippet-types(#5174 batch 8). Filed rather than fixed:packages/*/srcis outside that PR's surface.What the shipped declaration says
packages/data-objectstack/dist/index.d.ts:DataSourceis@object-ui/types' interface (packages/types/dist/data.d.ts:292). It declaresfind,findOne,create,update,delete,bulk,batchTransaction,getObjectSchema,aggregateand the import/export job surface — and none of the adapter-only members.The measured consequence
Compiled against the built
distwith the doc-snippet gate's own compiler options and module resolution:The same four, plus
getConnectionState,isConnected,onConnectionStateChangeandonBatchProgress, are exactly the memberspackages/data-objectstack/README.md's own API Reference — ObjectStackAdapter — Methods list documents, and that four whole README sections (Metadata Caching, Connection State Monitoring, Batch Operation Progress, Troubleshooting/Cache Issues) are built around. The declaration typing the exportedObjectStackAdapterclass carries all of them; only the factory's declared return narrows them away.So a reader who follows the README's own Basic Setup —
const dataSource = createObjectStackAdapter({ baseUrl })— and then follows any of those four sections does not compile. The runtime object has the methods; the declared type does not admit them.Why this is a producer-side gap, not a doc bug
The methods are real, exported and documented; there is nothing to correct on the page. The cast-free escape a consumer has today is to construct the class instead (
new ObjectStackAdapter(config)), which the README's own API Reference documents as public — so the two supported ways of obtaining the same object give different type surfaces.Options
createObjectStackAdapter(config): ObjectStackAdapter(orDataSource<T> and ObjectStackAdapter). One line, and it makes declared match shipped for every documented member at once.DataSource. Wrong shape: caching, connection state and batch progress are this adapter's concerns, not every data source's, and every otherDataSourceimplementation would then be declaring members it does not have.Recommendation: A.
Where this shows up now
Batch 8 ships those README blocks compiling, by declaring the adapter as the exported
ObjectStackAdapterclass — truthful about the object, and about the one supported way to obtain that type today — and adds a short note to the README's setup section naming this card, so the page does not silently teach a shape the factory's return will reject. The note comes out when this is fixed.