You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Contents Introduction Issue Solution Introduction Branded types in TypeScript enable the creation of new types by affixing a type tag to an existing underlying type. This tag, commonly referred to as the "brand", distinguishes values of the branded type from others sharing the same underlying type. Acting as a compile-time validator, the brand ensures that values are utilized correctly within thei
TSKaigi 2024 のトークと、登壇者がスライドを公開していればその URL を記載しています。 トラックごとのトーク、および登壇者情報は公式サイトに詳しく掲載されているので、そちらをご確認ください。
2024/05/11に行われたTSKaigiで発表したLTの資料です! ◎概要 TypeScriptはJavaScriptのスーパーセットとして、静的型付けと高度な型システムを提供し、大規模なプロジェクトの開発を助けています。しかし、これらの利点を最大限に活用するためには、コンパイルパフォーマン…
Effect-TS(正式名称は Effect)は、開発者が複雑なエラーや非同期処理をより安全に開発できるようにすることを目的とした TypeScript ライブラリです。Effect System という概念を取り入れており、Scala や Haskell といった関数型プログラミング言語に影響を受けています。 TypeScript の型システムを活用して、本番のアプリケーションにおける実用的な問題を解決することを目指しています。Effect-TS は、以下のような特徴を備えています。 並行性(concurrency):Fiber ベースの並行モデルにより、高いスケーラビリティと低レイテンシを実現 コンポーザビリティ(composability):小さく再利用可能なパーツを組み合わせることで、メンテナンス性、可読性、柔軟性の高いソフトウェアを構築する リソースの安全な管理(resource
In most programming languages a variable has a type and that type does not change. But one of the most interesting aspects of TypeScript's type system is that a symbol has a type at a location. Various control flow constructs can change this type: function refine(x: string | number) { // type of x is string | number here if (typeof x === 'number') { // type of x is number here. } else { // type of
Matt PocockMatt is a well-regarded TypeScript expert known for his ability to demystify complex TypeScript concepts. A couple of years ago, Sentry were having big problems with their React app. They'd pretty recently migrated it to TypeScript from JavaScript. And the app was part of a large monorepo. But the IDE performance was slow. You'd often need to wait a couple of seconds after making a chan
Matt PocockMatt is a well-regarded TypeScript expert known for his ability to demystify complex TypeScript concepts. TypeScript 5.5 will be dropping in the next couple of months. And thanks to one PR in particular, I already know it's going to be an incredible release. On Friday night, TypeScript merged Dan Vanderkam's PR to "Infer type predicates from function bodies using control flow analysis".
Matt PocockMatt is a well-regarded TypeScript expert known for his ability to demystify complex TypeScript concepts. If you've worked with TypeScript and JSX for enough time, you'll probably have run into a situation where you want to restrict a component's children to be of a certain type. Let's say you're working on a Select component that takes Option components as children. You want to make su
Matt PocockMatt is a well-regarded TypeScript expert known for his ability to demystify complex TypeScript concepts. There's a common issue that comes up whenever you try to use Array.reduce to transform an array into an object. Learning how to fix it can teach you a lot about how to handle Array.reduce in general. Here's a playground: see if you can fix the error in the code below. #Why Is The Er
Matt PocockMatt is a well-regarded TypeScript expert known for his ability to demystify complex TypeScript concepts. tsconfig.json scares everyone. It's a huge file with a TON of potential options. But really, there are only a few configuration options you need to care about. Let's figure them out, and cheatsheet them. #The Package This article is so popular that I've bundled its recommendations i
As web development has embraced static typing during the past decade, TypeScript has become the default language of choice. I think this is great—I love working with TypeScript! But what if you can’t use TypeScript? You may encounter circumstances where you need to work in plain JavaScript, be it tooling constraints or a team member who does not like static typing. Under these circumstances, look
type User = { name: string } type Admin = User & { permissions: string[] } const user: User = { name: "user", } const admin: Admin = { name: "admin", permissions: [], } User は名前だけを持つ型で、Admin は名前と権限を持つ型です。また、それぞれの型の変数も用意しています。 この後のコード例は極力シンプルにするため、やや不自然なコードになっていますがご了承ください[1]。 サブタイプとスーパータイプ Admin 型の変数は name プロパティを持ち、User 型の条件を満たしています。そのため、User 型の変数には Admin 型の変数を代入できます。 その逆は型エラーになります。User 型の変数には perm
Matt PocockMatt is a well-regarded TypeScript expert known for his ability to demystify complex TypeScript concepts. You might have noticed that there are two ways you can annotate a function on an object in TypeScript. interface Obj { // Method shorthand syntax version1(param: string): void; // Object property syntax version2: (param: string) => void; } They look very innocuous. But there's a sub
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く