nano-match 🎯 nano-match is a tiny utility simplifying key-based matching in TypeScript, bringing elegance to your code. Installation 🚀 import { match } from '@jay-es/nano-match'; type Language = 'en' | 'es' | 'fr'; const lang: Language = 'en'; // Strict matching, only allows valid keys of type 'Language'. const greeting = match(lang, { en: "Hello.", es: "Hola.", fr: "Bonjour.", }); console.log(g
// Import decorators from library import { JsonObject, JsonProperty } from 'typescript-json-serializer'; // Enums export enum Gender { Female, Male, Other } export enum Status { Alive = 'Alive', Sick = 'Sick', DeadAndAlive = 'Dead and alive', Dead = 'Dead' } // Create a JsonObject class: LivingBeing // JsonObject decorator @JsonObject() export class LivingBeing { /** The living being id (PK) */ @J
Without ts-reset: 🚨 .json (in fetch) and JSON.parse both return any 🤦 .filter(Boolean) doesn't behave how you expect 😡 array.includes often breaks on readonly arrays ts-reset smooths over these hard edges, just like a CSS reset does in the browser. With ts-reset: 👍 .json (in fetch) and JSON.parse both return unknown ✅ .filter(Boolean) behaves EXACTLY how you expect 🥹 array.includes is widened
// Comments are kept :) type ComplexType map[string]map[uint16]*uint32 type UserRole = string const ( UserRoleDefault UserRole = "viewer" UserRoleEditor UserRole = "editor" // Line comments are also kept ) type UserEntry struct { // Instead of specifying `tstype` we could also declare the typing // for uuid.NullUUID in the config file. ID uuid.NullUUID `json:"id" tstype:"string | null"` Preference
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く