Skip to content

Instantly share code, notes, and snippets.

View tomtom103's full-sized avatar
:shipit:
Investigating...

Thomas tomtom103

:shipit:
Investigating...
View GitHub Profile
@AzrizHaziq
AzrizHaziq / I18n.ts
Last active May 3, 2024 04:07
JS & TS
// https://kentcdodds.com/blog/listify-a-java-script-array
// unfortunately TypeScript doesn't have Intl.ListFormat yet 😢
// so we'll just add it ourselves:
type ListFormatOptions = {
type?: 'conjunction' | 'disjunction' | 'unit'
style?: 'long' | 'short' | 'narrow'
localeMatcher?: 'lookup' | 'best fit'
}
declare namespace Intl {
class ListFormat {