Welcome to examples pageTest out the power of our TypeScript library and get to know TypeGPU. Learn more about TypeGPU here
I saw a post by qntm and remembered I had a playground with a similar idea. I then expanded that playground into a (probably non-exhaustive) list of ways to cast between arbitrary1 types in Typescript: Convention: The as Operator Ah, good ol' as: const cast = <A, B,>(a: A): B => a as unknown as B; We can't just directly do a as B because Typescript is smart enough to warn us about that, at least.
はじめに TypeScriptで型を定義する際、interface と type のどちらを使うべきか。これは、多くの開発現場で一度は議論になるテーマではないかと思います。 世の中の多くのドキュメントや記事では、クラスへの implements のしやすさや、interface が持つ「宣言のマージ(Declaration Merging)」の利便性が紹介されることもあり、interface の利用が推奨されるケースもよく見かけます。 しかし、特にサーバサイドアプリケーションや、ある程度規模のあるシステムを開発する上で、私はこの「宣言のマージ」機能が、時として予期せぬ挙動や、場合によってはセキュリティ上のリスクを静かにもたらす要因になると感じています。 今回は、なぜ私がプロダクトコードにおいて interface の積極的な使用を避け、type エイリアスを好んで使うのか、具体的なシナリオ
必要もないのに querySelector や querySelectorAll の型引数を指定しないようにしましょう. (この記事は AI レビュワーに「型引数を指定した方が型安全だ」と提案されたのに対する反論として作成しています.) querySelector の型安全性 querySelector や querySelectorAll の型定義は, 後述する要素型セレクターに関連する部分を除くと, 基本的には以下のようになっています. querySelector<E extends Element = Element>(selectors: string): E | null; querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>; これはつまり型引数が Element を継承し
この記事では、TypeScript の開発環境を最速で整えます。単に動く環境ではなく、最低限必要なツールも一通りそろえていきます。(2025 年秋時点の情報です) この記事で作る開発環境について この記事のゴール bun run コマンドで TypeScript ファイルを実行できる bun repl コマンドで REPL を起動して TypeScript を実行できる bun tsc --noEmit コマンドで(厳しい)型チェックができる TypeScript Language Server でコード補完と型チェックができる bun biome コマンドでフォーマットとリントができる Biome の拡張機能でリントが開発中にも実行される Biome の拡張機能でフォーマットと自動修正が保存時に自動で実行される bun test コマンドでテストコードを実行できる Bun の拡張機能でテ
Connect, collaborate, and grow with a community of TypeScript developers. Elevate your skills through interactive coding challenges, discussions, and knowledge sharing
Infrastructure as TypeScript Deploy to Cloudflare, AWS, and more with pure TypeScript. Generate support for any API in minutes with AI. const database = await Database("my-database"); const website = await Worker("website", { bindings: { DB: database, }, }); const price = await Price("basic-license", { currency: "usd", unitAmount: 2999, // $29.99 product: "prod_xyz" }); const database = await Data
個人開発で CockroachDB を使いたかったのだが、有名どころの drizzle や Prisma でマイグレーションしようとすると、うまくいかなかった。 drizzle-orm はそもそも CockroachDB サポートが計画段階なのだが、PostgreSQL 互換だし動くだろうと思って pg ドライバで動かすとマイグレーションでデータ型関連のエラーが発生してしまう。Prisma も原因は別だが CockroachDB 特有の機能でエラーが起きる。 では、なにかNode.js系のマイグレーションツールを適当に採用しようか... という所だが、よくあるやつはマイグレーションのSQLやコードそのものを基本的に手書きする。これがやりたくない。理想的には Ruby 界隈の ridgepole のように宣言的なスタイルでマイグレーションができ、かつ Node.js エコシステムと親和性の高
A dead-simple TypeScript compiler that does one thing really well: enables compile-time evaluation of expressions marked with comptime. This is useful for optimising your code by moving computations from runtime to compile time. This project was inspired by Bun macros and Zig comptime (hence the name). Warning: You are responsible for ensuring that the expressions you mark with comptime are safe t
Today we are excited to announce the release of TypeScript 5.9! If you’re not familiar with TypeScript, it’s a language that builds on JavaScript by adding syntax for types. With types, TypeScript makes it possible to check your code to avoid bugs ahead of time. The TypeScript type-checker does all this, and is also the foundation of great tooling in your editor and elsewhere, making coding even e
We are happy to announce that Biome v2 is officially out! 🍾 Biome v2—codename: Biotype, the first JavaScript and TypeScript linter that provides type-aware linting rules that doesn’t rely on the TypeScript compiler! This means that you can lint your project without necessarily installing the typescript package. With this release, the Core Contributors of the project want to show to the whole comm
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く