<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/typescript-for-apps-vs-typescript-for-sdks-qm2p96yhd" -->

---
title: Typescript For Apps Vs Typescript For SDKs | daily.dev
description: An Inngest engineer reflects on refactoring the Inngest TypeScript SDK through a major version update, describing how writing types for a public SDK differs...
canonical: https://daily.dev/posts/typescript-for-apps-vs-typescript-for-sdks-qm2p96yhd
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Typescript For Apps Vs Typescript For SDKs | daily.dev
og:description: An Inngest engineer reflects on refactoring the Inngest TypeScript SDK through a major version update, describing how writing types for a public SDK differs...
og:url: https://daily.dev/posts/typescript-for-apps-vs-typescript-for-sdks-qm2p96yhd
og:image: https://api.daily.dev/og/posts/qm2P96YhD.png
og:image:alt: Typescript For Apps Vs Typescript For SDKs
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Typescript For Apps Vs Typescript For SDKs

**[Inngest Blog](https://daily.dev/sources/inngest)** · 8 min read · 0 upvotes · 0 comments

## Summary

An Inngest engineer reflects on refactoring the Inngest TypeScript SDK through a major version update, describing how writing types for a public SDK differs fundamentally from writing types for an internal app. The piece explores 'types as guardrails vs. types as API,' shows concrete examples of crafting readable compiler error messages (like a custom StaticTypeError utility type to replace an unreadable Zod transform error), and walks through resolving a createFunction signature change to accept single triggers, arrays, or nothing. It closes with practical advice: treat exported types as public commitments, write intentional error messages, test types with tools like tsd, and watch for internal implementation details leaking into public type surfaces.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.inngest.com/blog/typescript-types-as-api>

## Questions this post answers

### How do you write a custom TypeScript error message for invalid generic type usage in a library?

Define an identity utility type, such as type StaticTypeError<TMessage extends string> = TMessage, and use conditional types to resolve to that message when a constraint fails. For example, checking a Zod schema's input and output types and returning StaticTypeError<"Transforms not supported: schema input/output types must match"> instead of a cryptic StandardSchemaV1 mismatch error turns an unreadable compiler message into a human-readable one, with no runtime cost.

_Developers designing library type errors can find more SDK-authoring lessons like this through daily.dev._

### How can a TypeScript function accept a single item, an array of items, or nothing at all for the same parameter?

Type the parameter as optional using a union like triggers?: SingleOrArray<Trigger> | undefined, then internally normalize it with a conditional type such as ResolveTriggers<T> = T extends undefined ? [] : AsArray<NonNullable<T>>. This lets callers pass a single trigger object, an array of triggers, or omit the field entirely, while the internal implementation always works with a plain array.

_Anyone designing flexible SDK function signatures can track type-design patterns like this via daily.dev._

## Similar posts on daily.dev

- [How We Built Tinybird's TypeScript SDK for ClickHouse](https://daily.dev/posts/how-we-built-tinybird-s-typescript-sdk-for-clickhouse-xqc3ufsiz) · Tinybird · 1 upvotes · 0 comments
- [TypeScript on GitHub: What Its Rise Means for JavaScript Developers](https://daily.dev/posts/typescript-on-github-what-its-rise-means-for-javascript-developers-xeivcgtai) · Syncfusion · 0 upvotes · 0 comments
- [20 Mistakes That Quietly Destroy JavaScript/TypeScript Codebases \(Part 1\)](https://daily.dev/posts/20-mistakes-that-quietly-destroy-javascript-typescript-codebases-part-1--n6okeimrf) · The T-Shaped Dev · 6 upvotes · 0 comments

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#typescript](https://daily.dev/tags/typescript), [#type-systems](https://daily.dev/tags/type-systems), [#zod](https://daily.dev/tags/zod)

[View this post on daily.dev](https://daily.dev/posts/typescript-for-apps-vs-typescript-for-sdks-qm2p96yhd)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Typescript For Apps Vs Typescript For SDKs","url":"https://daily.dev/posts/typescript-for-apps-vs-typescript-for-sdks-qm2p96yhd","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/typescript-for-apps-vs-typescript-for-sdks-qm2p96yhd"},"datePublished":"2026-09-13T19:57:29.096Z","dateModified":"2026-09-13T19:59:34.002Z","description":"An Inngest engineer reflects on refactoring the Inngest TypeScript SDK through a major version update, describing how writing types for a public SDK differs...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7d883c5ec6497374ab9994a6ce7f5024?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7d883c5ec6497374ab9994a6ce7f5024?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Inngest Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Inngest Blog","logo":"https://media.daily.dev/image/upload/s--ieZKUa5y--/c_limit,w_256/f_auto,q_auto/v1789329423/logos/inngest?_a=BAMAMicg0","url":"https://daily.dev/sources/inngest"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/typescript-for-apps-vs-typescript-for-sdks-qm2p96yhd","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"architecture,typescript,type-systems,zod","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Inngest Blog","item":"https://daily.dev/sources/inngest"},{"@type":"ListItem","position":3,"name":"Typescript For Apps Vs Typescript For SDKs"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/typescript-for-apps-vs-typescript-for-sdks-qm2p96yhd#faq","mainEntity":[{"@type":"Question","name":"How do you write a custom TypeScript error message for invalid generic type usage in a library?","acceptedAnswer":{"@type":"Answer","text":"Define an identity utility type, such as type StaticTypeError\u003cTMessage extends string\u003e = TMessage, and use conditional types to resolve to that message when a constraint fails. For example, checking a Zod schema's input and output types and returning StaticTypeError\u003c\"Transforms not supported: schema input/output types must match\"\u003e instead of a cryptic StandardSchemaV1 mismatch error turns an unreadable compiler message into a human-readable one, with no runtime cost. Developers designing library type errors can find more SDK-authoring lessons like this through daily.dev."}},{"@type":"Question","name":"How can a TypeScript function accept a single item, an array of items, or nothing at all for the same parameter?","acceptedAnswer":{"@type":"Answer","text":"Type the parameter as optional using a union like triggers?: SingleOrArray\u003cTrigger\u003e | undefined, then internally normalize it with a conditional type such as ResolveTriggers\u003cT\u003e = T extends undefined ? [] : AsArray\u003cNonNullable\u003cT\u003e\u003e. This lets callers pass a single trigger object, an array of triggers, or omit the field entirely, while the internal implementation always works with a plain array. Anyone designing flexible SDK function signatures can track type-design patterns like this via daily.dev."}}]}
```

