Acid Coder

Acid Coder @tylim88

About: Who needs meth when you have Typescript?

Joined:
Oct 31, 2021

Acid Coder
articles - 54 total

Stop using Eslint and Prettier, use Biomejs instead! End Bike Shedding!

Eslint and Prettier are frustrating to configure, they also run slowly learn how to setup biomejs in...

Learn More 3 0Jun 18

TS-Hajime: Effortlessly Bootstrap TypeScript NPM Libraries

I made a library that can easily bootstrap your TypeScript library with better DX tools. It focuses...

Learn More 1 0Oct 13 '24

JS being weird again: forcibly convert synchronous statement to asynchronous with async function

Today I came across a tweet: https://twitter.com/BenLesh/status/1717272722193965511 I was...

Learn More 5 13Oct 26 '23

Typescript Flatten Object Type

type ToPaths<T, P extends string = ''> = T extends Record<number, unknown> ? { ...

Learn More 1 0Jun 29 '23

Typescript Nominal Type: The Right Way

In case you don't know what RighFminal typing Typescript is a structural typing language, but it is...

Learn More 1 10Jun 28 '23

Typescript Type Level Custom Error Message For Utility Types

In the previous article, we have learned how to create custom type level error message for our...

Learn More 0 0Jun 28 '23

Typescript Type Level Custom Error Message, Move Runtime Error to Compile time Error!

Do you want a more descriptive error message rather than usual type A cannot assign to type B? for...

Learn More 2 0Jun 26 '23

Function: The Savior of Scope. The Story Of Immutability And Declarative.

You likely heard of the term Functional Programming, that it is declarative, immutable, pure...

Learn More 0 0Jun 21 '23

Typescript WTF Moment 12: Beware of Object Literal Unions

type ABC = { A: number, B: number } | { C: number } const abc: ABC = { A: 1, B: 2, C: 3 } // no...

Learn More 6 0Jun 20 '23

Write Declarative, Immutable and Flattened Code by Combining Promise and Async Await. The Great Escape From The 4 Hells

(Note: Promise here refer to Promise Chain) Try to google "mix promise and await" , the first two...

Learn More 0 1Jun 18 '23

Translate Speech Into Japanese (open source web app)

This web application translates speech into Japanese speech, try it at...

Learn More 0 0May 2 '23

0 command SSH for Dummy using Bitvise Client

download bitvise client https://www.bitvise.com/ssh-client-download -setup your login credential...

Learn More 0 0May 1 '23

Typescript Loop Tuple With Length > 1000

We cannot recurse tuple with more than 1000 length due to TS limitation In this example we try to...

Learn More 2 0Dec 24 '22

Typescript WTF Moments 11: Function Unions: any Param Is Not any

observe the code below type A = ((v: true) => void) | ((v: false) => void) const abc: A =...

Learn More 0 0Dec 24 '22

Typescript WTF Moments 10: The Special Case: T[] extends B[]

observe the below example: type A = boolean; type B = string; type C<T extends B> =...

Learn More 2 0Dec 23 '22

Typescript WTF Moments 9: Evolving Empty Array Type

const a = false || [] // ^? const b = [] // ^? function c() { // ^? return [] } const...

Learn More 4 0Dec 20 '22

Typescript Why You Should Avoid Explicit Function Generics If Possible

There are few reasons, the obvious reason is: optimal developer experience An intelligence type do...

Learn More 1 0Dec 15 '22

Typescript Recursion: It Is Over 999!

This is a proof of concept post, personally I do not find any use of this, yet Typescript recursion...

Learn More 3 0Dec 15 '22

Typescript Concat Tuples Type

type ConcatArrays< ACC extends any[][], N extends 1[] = [] > = [...ACC[N['length']],...

Learn More 0 0Dec 15 '22

Typescript Generate Full Path Type And Get Value Type Of Nested Union Object With Numeric Key

Before TS 4.8, obtaining value type for path A/${number} of { A: Record<number, boolean> } is...

Learn More 9 4Dec 14 '22

Typescript Single Import Type Equality Check

background: type equality check Typescript power users often find themselves in the need of type...

Learn More 5 0Nov 16 '22

Introducing FireSageJS, Ultimate Type Safety for Firebase Realtime Database

I made a library that solves Firebase Realtime Database typing problems. It is the sister project of...

Learn More 3 0Nov 15 '22

Typescript WTF Moments 8: Type Level Equality Not Working With Intersection

export type IsSame<T, U> = (<G>() => G extends T ? 1 : 2) extends < G >()...

Learn More 0 0Sep 22 '22

Typescript WTF Moments 7: Boolean can extends Record<infer X,unknown>

type o = boolean extends Record&lt;infer X, unknown&gt; ? X : false // valueOf // ...

Learn More 1 3Aug 22 '22

Typescript Greater Equal Or Lesser

type level numeric comparator export type CreateArrayWithLengthX&lt; LENGTH extends number, ...

Learn More 0 0Aug 19 '22

Typescript WTF Moments 6: Non Collapsing Object Unions

Object unions of same type do not collapse type a = 1 | 1 // 1, collapsed // ^? type b = { a:1...

Learn More 2 0Aug 19 '22

Typescript WTF Moments 5: const a = 'a' is not equal to const a = 'a' as const and const a:'a'='a'

normally we can skip type annotation because we know that typescript will infer the type for us but...

Learn More 3 0Aug 10 '22

Typescript WTF Moments 4: never extends `${infer P}` yield different result than never extends `${infer P}/`

type a = never extends `${infer P}` ? P : 1 // never // ^? type b = never extends `${infer P}/` ?...

Learn More 3 0Aug 8 '22

Typescript When You Should Mix Type Alias And Interface

let say you want to convert number types to undefined given arbitrary object literal type, so here is...

Learn More 3 0Aug 8 '22

Typescript WTF Moments 3: Type of Key is `string` if Key is Template Literal `a/${string}`

const a = 'a' const obj = { [a]:1 } // {a:1} const b = 'b/a' as `b/${string}` const obj2 = { [b]:1...

Learn More 3 0Aug 8 '22