Convert stack, entry, asset, and content type calls
Once the new stack client exists, the migration becomes a series of request-chain translations. The important pattern is that the TypeScript Delivery SDK uses lowercase builders and returns data directly from fetch() and find().
What you'll learn
How to migrate single-entry reads
How to migrate entry collections
How to migrate assets
How to migrate content type reads
How to migrate sync calls
How to avoid common chain-order mistakes
Stack sync
In the JavaScript SDK, an initial sync often passes init: true:
const result = await Stack.sync({ init: true });In the TypeScript Delivery SDK, initialize sync with sync():
const result = await stack.sync();Other sync options stay familiar:
await stack.sync({ locale: 'en-us' });
await stack.sync({ start_date: '2026-01-01' });
await stack.sync({ content_type_uid: 'blog' });
await stack.sync({ type: 'entry_published' });
await stack.sync({ pagination_token: paginationToken });
await stack.sync({ sync_token: syncToken });Treat sync carefully if your app stores sync tokens. Verify that token persistence, retry behavior, and scheduled jobs still behave as expected after the SDK switch.
Single entries
JavaScript SDK:
const result = await Stack.ContentType('blog')
.Entry('entry_uid')
.toJSON()
.fetch();TypeScript Delivery SDK:
const result = await stack.contentType('blog')
.entry('entry_uid')
.fetch();With TypeScript response typing:
const result = await stack.contentType('blog')
.entry('entry_uid')
.fetch<BlogPost>();Remove toJSON() during this migration unless you have a specific compatibility layer that still depends on it.
Entry options
The method names stay close, but the chain changes:
await stack.contentType('blog')
.entry('entry_uid')
.includeBranch()
.fetch();
await stack.contentType('blog')
.entry('entry_uid')
.includeFallback()
.fetch();
await stack.contentType('blog')
.entry('entry_uid')
.only('title')
.fetch();
await stack.contentType('blog')
.entry('entry_uid')
.except('internal_notes')
.fetch();
await stack.contentType('blog')
.entry('entry_uid')
.locale('fr-fr')
.fetch();The old language() method becomes locale().
Entry collections
JavaScript SDK:
const result = await Stack.ContentType('blog')
.Query()
.toJSON()
.find();TypeScript Delivery SDK:
const result = await stack.contentType('blog')
.entry()
.find();For more complex filters, use query():
const result = await stack.contentType('blog')
.entry()
.query()
.equalTo('featured', true)
.find();Use entry('entry_uid') when you already know the entry UID. Use entry() when you are fetching a collection.
Assets
JavaScript SDK:
const asset = await Stack.Assets('asset_uid')
.toJSON()
.fetch();
const assets = await Stack.Assets()
.toJSON()
.find();TypeScript Delivery SDK:
const asset = await stack.asset('asset_uid').fetch();
const assets = await stack.asset().find();Asset queries can also use familiar collection helpers:
const assets = await stack.asset()
.includeCount()
.limit(20)
.orderByDescending('updated_at')
.find();Content types
Fetch one content type:
const contentType = await stack.contentType('blog').fetch();Fetch content types:
const contentTypes = await stack.contentType().find();Include global field schema details when retrieving content type information:
const contentTypes = await stack.contentType()
.includeGlobalFieldSchema()
.find();This is useful when schema inspection is part of your application or tooling. It is not usually needed for normal page rendering.
Key takeaways
Use lowercase SDK builders: stack, contentType, entry, and asset.
Use entry(uid).fetch() for one entry and entry().find() for collections.
Replace language() with locale().
Remove toJSON() from migrated TypeScript Delivery SDK chains.
Verify response shapes anywhere rendering code depends on transformed fields.
Frequently asked questions
What changes when migrating from the JavaScript SDK to the TypeScript Delivery SDK?
Builder methods become lowercase and responses come directly from fetch() and find(). Remove toJSON() unless you still need it for a compatibility layer.
How do I perform an initial stack sync in the TypeScript Delivery SDK?
Use stack.sync() without init: true. Other options like locale, start_date, content_type_uid, type, and tokens remain available.
How do I fetch a single entry versus an entry collection?
Use contentType('uid').entry('entry_uid').fetch() for a single entry. Use contentType('uid').entry().find() for collections, and add query() for filters.
What happened to the language() method?
language() is replaced by locale() in the TypeScript Delivery SDK.
How do asset and content type reads change in the TypeScript Delivery SDK?
Use stack.asset('asset_uid').fetch() or stack.asset().find() for assets. Use stack.contentType('uid').fetch() or stack.contentType().find(), optionally includeGlobalFieldSchema().