r/typescript • u/swe129 • Jun 13 '26
Template literal types guide
r/typescript • u/ivy-apps • Jun 13 '26
This is my last post. I decided to make free and open-source the Deslop architecture linter tool for TypeScript. It's an imports static analysis tool where you write your own rules in simple declarative YAML
Deslop aims to make deterministically enforcing your architecture (e.g. boundaries) and quality standards (existence of companion modules like tests, storybook) easier than having to write custom ESLint plugins that work with AST or regex in Dependency Cruiser.
Check it out, if you want: https://github.com/Ivy-Apps/deslop
r/typescript • u/Amarzcode • Jun 13 '26
As a 2th cs student, I've tried almost everything to make money from coding, but I barely got a few bucks from freelancing, and It was a HORRIBLE experience. Latterly, I hated freelancing a lot, and I'm not fit into this kind of work.
So I tried to get into the job market and made like 4 interviews in last year, and somehow I didn't move forward, cuz of uni shit, ever time They know me that I'm still a student, I got rejected !!!!.
I know I can build a startup, but it takes time and effort, so what do you guys think ?
r/typescript • u/Midk_1 • Jun 11 '26
-- SELF PROMO WARNING --
boringstack, as the name implies, is a very boring tech stack with tech like NestJS and MariaDB, while other popular tech stacks seek novelty and hype while still being the best choice for serverless (Bun, Next.js, Tanstack, SQLite, etc...) this stack is meant to be a simple stack deployed with Docker on your favorite 10$ VPS, with the frontend fueled by my beloved Svelte 5
It's pretty new, contributions are accepted!
r/typescript • u/shaberman • Jun 11 '26
Hey folks, we wanted to implement the closure table pattern for some auth logic at work, and realized the declarative/reactive infra of our Joist ORM made it particularly succinct, so wrote up a post about how it worked out. Thanks!
r/typescript • u/dupontcyborg • Jun 08 '26
I've posted about numpy-ts a several times here now, but I swear I'm no shill!
Wanted to share some things I learned while optimizing the library. Most of this might already be obvious, and there's a lot left to do, so lmk if you have any suggestions
r/typescript • u/brokePlusPlusCoder • Jun 07 '26
Hi all, apologies if this isn't the right sub for this.
Some context : I'm a Java dev currently dipping my toes into the TS world. I've been tasked with refactoring some FE code due to a backend code change (Frontend team is massively overworked and I was the one that architected said backend change so it made sense to let me have a crack at it). The change is basically a location swap for some data within existing types. Here's a simplistic example:
// before
type SomeType = {
//... other data
someEntry : {...}; // data belonging to someEntry is moving to a different key
}
// after
type SomeType = {
//... other data
otherKey: {
diffentry : {...}; // after move. Data is unchanged, just a location swap
}
}Thing is, there are several subtypes extending SomeType and for several reasons (mostly manpower related) we can't do a wholesale migration on backend just yet...which means some objects end up with the "before" state while others are in the "after" state. Frontend needs to be able to cater to both for an extended period of time until backend finishes the migration on their end.
Given that the data within the keys is still the same, I initially thought to create a union type like so:
type BaseType = BeforeType | AfterType;
type BeforeType = {
someEntry : {...};
}
type AfterType = {
otherKey: {
diffentry : {...};
}
}
type SomeType = BaseType & {
// ... all other data in SomeType that doesn't exist in either BeforeType or AfterType
}This seems fine on the surface, but the more I dug deeper into TS types the more I realised there were issues (e.g. this breaks any interfaces that try to extend from SomeType or BaseType). Fortunately the Frontend code doesn't have many interfaces at the moment and trialling this option seemed feasible - from what I've seen I'd need to limit the usage of these types to type narrowing operations, and the code is already structured to a good degree around that way (obj -> type narrowed to SomeType -> direct data access is the dominant pattern). I'm also making this safer by delegating the data access part to conveneince functions.
I've talked this through with the Frontend guys and they're ok with it, but I'd like to double check with the community here to see if this is indeed okay, or if there are other issues I may be missing. Thanks in advance !
r/typescript • u/stackokayflow • Jun 06 '26
Have you ever had your code snippets in your docs drift from your current API's and have it reported by users? š
Have you had LLM's hallucinate API's in code snippets in your md examples? š
Today I have the solution you're looking for!
Introducing Kiira.dev
It runs tsc on your .md code snippets and reports any issues it finds using your repos tsconfig with options to autofix, no more outdated or wrong API's in your documentation!
Works anywhere and lints any TS file, comes in three flavors:
- CLI
- VS code extension
- Github action
Highly configurable for any project with sane defaults.
VSCode extension:
https://marketplace.visualstudio.com/items?itemName=CodeForge.kiira-vscode
Github:
https://github.com/AlemTuzlak/kiira
Npm:
r/typescript • u/philippemnoel • Jun 05 '26
Hi all! We created this NPM package to make it easier to use ParadeDB (a full-text & vector search extension for Postgres) within the TypeScript ecosystem. It is built as an extension to the Drizzle ORM. Would love your feedback!
r/typescript • u/Gloomy-Status-9258 • Jun 04 '26
Someone use TS in a bad way, while others criticize JS.
EDIT: To be fair, and what criticisms are valid?
r/typescript • u/abelg101 • Jun 03 '26
Both expressions evaluate to the boolean literal true at runtime, but TypeScript only flags one of them as an always-true condition.
if (!!2 == true) // Warning: "This kind of expression is always truthy. ts(2872)"
if (!!1 == true) // No warning, but why?You can verify they're identical at runtime:
console.log(typeof !!1) // boolean
console.log(typeof !!2) // boolean
const a = !!1 // hovers as: "const a: true"
const b = !!2 // hovers as: "const b: true", but has the same warningTypeScript's own type inference agrees they're both the literal true, yet the always-true condition check behaves inconsistently between the two.
Is this a known bug in TypeScript's constant folding/control flow analysis? Has anyone run into this before? Would love to know if there's a deeper reason
r/typescript • u/maifee • Jun 03 '26
IndexedDB is powerful, but I always found the API pretty verbose for everyday use. And coming from a backend focused mentalilty, I sometimes found it hards to do stuff. Then I thought to myself, why don't I resolve this. And then I wrote this library. If you are coming from a backend team to fullstack, you will get the vibe. Now we can declare entity, version, crud call, and do other repeatative stuff quite easily.
Quick look:
@DataClass("users")
class User {
()
id!: string;
name!: string;
email!: string;
}
...
await db.create(user);
await db.read(User, "123");
await db.update(user);
await db.delete(User, "123");It supports many complex queries as well. Like:
const users = await db.User.query()
.where('age')
.gte(20)
.and('status')
.equals('active')
.orderBy('age', 'asc')
.execute();
const premiumOrTrial = await db.User.query()
.where((qb) =>
qb.where('type').equals('premium').and('status').equals('active'),
)
.or()
.where('isTrial')
.equals(true)
.execute();It has field level validation support as well:
((value: string) => value.length > 0, 'ID cannot be empty')
id!: string;
((value: string) => value.includes('@'), 'Invalid email')
({ unique: true })
email!: string;
u/Validate((value: number) => value >= 0 && value <= 150, 'Age must be 0-150')
age!: number;It has more cool features like, data retention policy, auto cleanup, schema versioning, rollback, atomic transaction
I just less than five years of full time experience, but I am trying to learn. So I am definetly open for reviews, and suggestions.
Would love feedback from people who use IndexedDB regularly and who doesn't as well. Would you use it now? What does it lack. Is it over engineered?
Any opinion would be helpful as well. Looking forward to hear from you. Enjoy your night!!
r/typescript • u/bogdanelcs • Jun 02 '26
r/typescript • u/im_caeus • Jun 01 '26
Iām looking for a TypeScript library for async streams/workflows where backpressure, cancellation, and resource safety are native to the abstraction rather than something I have to bolt on manually.
The kind of semantics Iām after:
The thing that pushed me here is that RxJS does not seem to model this the way I want. For example, if I create a stream from a "() => Promise<T>" and use "repeat()", it can keep producing without naturally accounting for whether the downstream consumer is slow. That makes sense for RxJSās push/observable model, but Iām looking for something with different default semantics.
For reference, the kind of model I have in mind is closer to Scalaās "fs2" or "ZIO Streams", but Iām not looking for a Scala clone. Iām looking for the closest practical equivalent in the TypeScript ecosystem.
Iām aware of a few possible directions: Effect, async iterators, Node streams, Web Streams, IxJS, Highland, etc. Iām trying to understand which ones actually have good out-of-the-box semantics for this, especially in production TypeScript code.
What are people using for this?
r/typescript • u/Noaks • Jun 02 '26
Hi, i'm sure this has been asked before, but I cant really find any good answers to my question. I have tried to follow some youtube guides and read some stuff but most stuff seems to be based on knowing js beforehand. I'm currently working as a PM for a company that uses ts,node etc. And i want to get a better understanding for it. Just learing on my own time as a hobby. I dont mind paying for a good course but i cant really find anything that seems good that starts with the bascis. From my understanding ts is essentialy just js but with a stricter set of rules and types.
It seems like just a bad habit to learn js first and then having to spend a bunch of time unlearning bad habits with ts. Does anyone have some advice on where i should start?
r/typescript • u/im_caeus • Jun 01 '26
Iām looking for a TypeScript DI/container library or pattern that fits these constraints:
The last two are important.
I donāt want something that behaves like NestJS by default, where the application/container eagerly initializes the whole graph at startup. Iād prefer lazy/on-demand initialization, where services are created only when needed, but where async setup is still modeled cleanly.
The async part matters because some services need setup before use: DB connections, config loading, SDK clients, caches, etc. Ideally there would also be a lifecycle story for shutdown/disposal.
Type-safety-wise, Iām thinking of something in the direction of "typed-inject", where tokens/dependencies are statically tracked, although Iād prefer stronger ergonomics/typing if possible.
Something roughly in this spirit:
const container = createContainer() .provide(Config) .provide(Database) .provide(UserRepository)
const repo = await container.get(UserRepository) // typed, lazily initialized
Iāve seen libraries like Inversify, tsyringe, Awilix, Typed Inject, and Effect Layers mentioned, but Iām trying to understand which options actually hold up when async initialization, lazy resolution, and CJS output are non-negotiable.
What are people using for this in real projects?
r/typescript • u/PUSH_AX • Jun 01 '26
The monthly thread for people to post openings at their companies.
* Please state the job location and include the keywords REMOTE, INTERNS and/or VISA when the corresponding sort of candidate is welcome. When remote work is not an option, include ONSITE.
* Please only post if you personally are part of the hiring companyāno recruiting firms or job boards **Please report recruiters or job boards**.
* Only one post per company.
* If it isn't a household name, explain what your company does. Sell it.
* Please add the company email that applications should be sent to, or the companies application web form/job posting (needless to say this should be on the company website, not a third party site).
Commenters: please don't reply to job posts to complain about something. It's off topic here.
Readers: please only email if you are personally interested in the job.
Posting top level comments that aren't job postings, [that's a paddlin](https://i.imgur.com/FxMKfnY.jpg)
r/typescript • u/OtherwisePush6424 • May 31 '26
A checklist for assessing npm packages before you install them. Includes TypeScript-specific checks (strict mode, ts-ignore usage, type coverage) alongside security signals like provenance attestation, active maintenance patterns, and CI pipeline quality. Covers real supply chain attacks and how to detect behavioral red flags.
r/typescript • u/Besmaah • May 31 '26
Iām currently building a TypeScript application in an Nx monorepo that includes a Fastify API, a React Native app, a Dragster data pipeline, and a React admin panel.
Currently, since I come from the PHP worldāand more specifically SymfonyāIāve always been familiar with the MVC architecture, which I really appreciate because itās fairly simple to understand.
But recently Iāve become interested in the Hexagonal / Ports and Adapters architecture because Iām currently implementing my event system with BullMQ for background tasks.
Although it seems tempting because it decouples the core business logic from the implementations, I find it feels very formal. Iām not an expert, and Iāve never worked on very large projects in production, so maybe Iām missing something.
Iām wondering what architecture you use and in what context (large scale production projects, large companies)ā¦.
What do you think of the Hexagonal architecture? Have you ever used it? Isnāt the benefit of decoupling offset by the complexity of the architecture?
If you are working on large scale projects, what is the most relevant architecture for you ?
r/typescript • u/agriculturez • May 29 '26
Hey everyone. I wrote a blog post on why tsgo uses so much memory.
I had a hunch it was related to overhead due to multi-threading (which is true), so I poked around and learned some things:
So the end result is basically that 2 threads can end up doing the same work and allocating memory for the same types.
A simple example:
a.tsb.tsb.ts imports a bunch of types from a.tsa.tsIt's pretty common for Typescript projects to have:
This compounds with the typechecker thread duplication problem, and finally the fact that the typechecker never frees memory allocated for types means peak memory usage can be quite high.
I go into more detail in the blog post!
r/typescript • u/youngsenpaipai • May 30 '26
Shipped v1.0.0 of merlin-commit (interactive CLI for conventional commits). More useful to share what building it strict TypeScript + ESM-only actually taught me.
ESM-only is cleaner than I expected, once you commit.Ā execa v9 and chalk v5 are both ESM-only, which forced the decision early. The catch: you need .js extensions on all relative imports even when the source is .ts. TypeScript resolves these at compile time, but it's unintuitive the first time you see it.
noUnusedLocals does not catch unused exports. Spent too long wondering why dead code was surviving - noUnusedLocals: true only works within a module boundary. For exported symbols you need a linter rule or ts-prune. This surprised me.
Type-safe config validation without Zod.Ā The config lives at ~/.merlinrc.json, fully user-controlled. I wrote validateConfig(unknown): Partial<MerlinConfig> that narrows field-by-field manually. Would probably reach for Zod if I started over - but doing it manually at least makes clear what Zod is actually doing under the hood.
Testing SIGINT in Vitest.Ā Mocking process.on('SIGINT', ...) and verifying cleanup works, but you have to be careful the handler doesn't let the test process exit before assertions run.
GitHub:Ā github.com/mBukator/merlin-commit
npm install -g merlin-commit
Does anyone have a clean solution for catching unused exports in strict-mode TypeScript projects that isn't just "add ts-prune and forget about it"?

r/typescript • u/human_clown_shoe • May 27 '26
I think one of the first instances I've heard people using pd/libpd for something that wasn't strictly about making music was for that classic game Spore. That game used pd as an audio-engine. I was then really surprised to notice it hadn't really, at least not successfully been ported to the browser. So I ported it and created TS-library that wraps libpd ā Pure Data's embeddable audio runtime ā compiled to WebAssembly, running inside an AudioWorklet.
The API looks roughly like this:
```ts
import { createPd } from "libpd-wasm";
import workletUrl from "libpd-wasm/assets/libpd-worklet.js?url";
const pd = await createPd({
packages: ["vanilla", "cyclone"],
files: { "patch.pd": patchSource },
entry: "patch.pd",
workletUrl,
});
pd.connect();
pd.sendFloat("cutoff", 1200);
pd.sendFloat("resonance", 0.7);
```
The idea is that instead of writing complex DSP or audio logic in TS/JS (which isn't really possible to do anyway because of latency etc unless you're doing something very trivial and then you would probably be best of using something like tone.js instead)
you design it in Pure Data and use this as the audio engine ā controllable from TS via message passing. Patches can be loaded, edited, or generated at runtime, so it's not a static compiler.
Two major Pd external libraries (cyclone and ELSE) are statically linked into optional build variants, since browser WASM can't load C externals dynamically.
Repo:
https://github.com/hyrfilm/libpd-wasm
Playground (which also supports you to drag-and-drop in your own .pd patches)
r/typescript • u/Chun • May 27 '26
r/typescript • u/FluxParadigm01 • May 27 '26
We've been working on MoroJS for a while now.
The problem we kept running into was that TypeScript APIs usually start simple, then slowly turn into a stack of decisions around the router: validation, OpenAPI, auth, rate limiting, queues, realtime, deployment adapters, middleware ordering, etc.
None of those pieces are unusual on their own. The annoying part is that every project seems to reassemble them slightly differently, and after enough refactors the āsimple APIā becomes hard to reason about.
MoroJS is our attempt at treating those production concerns as part of the framework contract instead of a bunch of separate bolt-ons.
Some of the things we built into the route/app layer:
The goal is not to make another tiny router. Itās to make the production version of your API less painful to build and maintain. Furthermore end the need to recreate the wheel, find an adaptor that may or may not work, etc.
Project is here for context:Ā https://morojs.com
Feedback welcome! Happy Coding!