Sidebar

TypeScript

typescript
TypeScript jnkrtech 1 month ago 100%
[self post] Extensible TypeScript with Object Algebras https://jnkr.tech/blog/object-algebras

cross-posted from: https://programming.dev/post/18004176 > I think object algebras have huge potential to improve the way complex software is written but I've never seen them used in practice. I think one reason why is that the research paper which introduced them is pretty hard to read. This post is my attempt to change that. > > I've been working on this post off and on for like two years so I'm really excited to share it with people. It is very long. There's a lot of ground to cover.

4
0
typescript
TypeScript SatouKazuma 1 month ago 100%
Looking for a guide to TypeScript for idiots

The issue? _I'm_ the idiot. Any suggestions for a guide to JS/TS for someone trying to learn about front-end development.

12
9
typescript
TypeScript arendjr 6 months ago 92%
Writing exhaustive switch statements in TypeScript https://arendjr.nl/blog/2024/03/exhaustive-switch-statements-in-typescript/

Today I'm sharing a little trick that I like to use to make switch statements cleaner and more type-safe. Happy to hear other ideas!

12
5
typescript
TypeScript lorefnon 6 months ago 100%
DBOS Cloud: A transactional serverless computing platform with first-class TypeScript environment www.dbos.dev

> DBOS Cloud, a transactional serverless computing platform, made possible by a revolutionary new operating system, DBOS, that implements OS services on top of a distributed database. We’ve used this new architecture to build a novel TypeScript transactional programming environment that enhances applications with automatic statefulness, transactionality, observability, and cyber-resilience. This makes fault-tolerant cloud-native application development much simpler and faster.

3
1
typescript
TypeScript lorefnon 8 months ago 100%
Remeda github.com

Modern utility toolbelt - rapidly evolving, type safe and esm friendly out of the box. No mutations.

8
0
typescript
TypeScript lorefnon 8 months ago 100%
typia typia.io

Typia is a transformer library supporting: - Super-fast Runtime Validators - Enhanced JSON functions - Protocol Buffer encoder and decoder - Random data generator

8
5
typescript
TypeScript lorefnon 9 months ago 100%
GitHub - lorefnon/collection-joiner: Type-safe utilities to join multiple collections from different sources into a single hierarchy github.com

When developing APIs or writing integration solutions, we often fetch data from multiple sources and combine them together. This requires quite a bit of boilerplate even if you use utility libraries like lodash. This library aims to be provide a simple type-safe utility that makes the task of combining multiple collections simpler using an intuitive association API. You may find this API to be reminiscent of association APIs found in ORMs. However, collection-joiner is completely agnostic about how these collections are obtained - so you could for example, fetch a list of users from a database, a list of departments from another service, a list of roles from a key value store and merge them into a single hierarchy when constructing a response.

4
0
typescript
TypeScript thepiggz 9 months ago 16%
OO awkward

addEventListener accept function references rather than objects with expected methods like handleEvent setTimeout and setInterval array map, filter, reduce, forEach, etc. promise then, catch, finally bind awkward closures what say v8? hidden classes fully init objects give me more perf tips

-4
1
typescript
TypeScript lorty 12 months ago 88%
So, are enums ok or not?

I have googled this and even got to the second page, and there does not seem to be any kind of consensus. As far as I can tell, it's a bad idea because it creates code you don't see and accepts inputs that you wouldn't want. And yet, many people seem to like them more than, say, const unions due to being easier to refactor in bulk. So what gives? Is this a case of IT people having very strong opinions on stuff that doesn't matter? Or is there a technical reason for or against it?

7
12
typescript
TypeScript lorefnon 12 months ago 100%
collection-joiner - A minimal typescript utility to combine multiple collections (possibly from different sources) into a single hierarchy - in a fully type-safe manner github.com

A minimal typescript utility to combine multiple collections (possibly from different sources) into a single hierarchy - in a fully type-safe manner.

4
0
typescript
TypeScript philnash 12 months ago 100%
One Thing Nobody Explained To You About TypeScript redd.one

Click bait title, but this post goes into depth about using tsconfig.json correctly and across different layers of your project.

16
1
typescript
TypeScript lorefnon 1 year ago 100%
GitHub - dsherret/ts-morph: TypeScript Compiler API wrapper for static analysis and programmatic code changes. github.com

Working with the primary TS compiler API is pretty arduous. It is nice to see dedicated community effort towards making this more approachable.

4
0
typescript
TypeScript fidodo 1 year ago 100%
Does anyone have recommendations on a raw postgres typing library? pgtyped vs zapatos vs slonik?

I've looked into these three and they all seem very similar and seem to cover the same use cases. Does anyone have experience with them? I'm having a hard time making a decision or even figuring out the pros and cons of each of them.

10
2
typescript
TypeScript telepresence 1 year ago 85%
type-safe GroupBy (key) function i wrote

i made a type-safe GroupBy function. ```typescript /** * Groups array of objects by a given key * @param arr array of objects to group * @param key must be present on every object, and it's values must be string|number * @author telepresence * @license CC-BY-4.0 */ function groupBy(arr: T[], key: keyof T, defaultAcc: Record = {}) { return arr.reduce((acc, val, i) => { const compValue = val[key]; if (typeof compValue !== 'string' && typeof compValue !== 'number') { throw new Error(`key ${key.toString()} has values other than string/number. can only group by string/number values`); } if (!acc[compValue]) acc[compValue] = [] acc[compValue].push(val); return acc; }, defaultAcc); } ``` - like lodash's groupBy, but by key and not function - group an array of objects which all have a key in common into an object with keys matching all the different possible values of your common key - **type-safe**, no unknown's no any's - does not copy arrays ([...array]), uses push - supports selecting by keys, where the key values are string / number (although you can easily add symbol support) - shared for free under the CC BY 4.0 license - only attribution is requred (link to this post is fine) - custom default accumulator support, if you already know the groups beforehand and would rather have an empty array than undefined. example: ```typescript const data = [{ "name": "jim", "color": "blue", "age": "22" }, { "name": "Sam", "color": "blue", "age": "33" }, { "name": "eddie", "color": "green", "age": "77" }]; groupBy(data, 'color') ``` would result into: ```ts { "blue": [ { "name": "jim", "color": "blue", "age": "22" }, { "name": "Sam", "color": "blue", "age": "33" } ], "green": [ { "name": "eddie", "color": "green", "age": "77" } ] } ``` TL;DR i've sucessfully wrote something using generics in typescript for the first time, and i think it's pretty epic.

5
0