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
import { asApi, Zodios } from '@zodios/core' import { z } from 'zod' const vR1x0k5qaLk = z.object({ id: z.number(), name: z.string() }).partial() const v8JbFEq2fUl = z.object({ id: z.number().optional(), name: z.string(), category: vR1x0k5qaLk.optional(), photoUrls: z.array(z.string()), tags: z.array(vR1x0k5qaLk).optional(), status: z.enum(['available', 'pending', 'sold']).optional(), }) const vlh
Today we’re announcing our beta release of TypeScript 4.9! To get started using the beta, you can get it through NuGet, or- use npm with the following command: npm install -D typescript@beta You can also get editor support by Downloading for Visual Studio 2022/2019 Following directions for Visual Studio Code. Here’s a quick list of what’s new in TypeScript 4.9! The satisfies Operator Unlisted Prop
Learn how to unleash the full potential of the Turing Complete type system of TypeScript! Introduction Type-level TypeScript is an online course to take your TypeScript skills from intermediate to advanced. It will give you a solid understanding of the type system's fundamentals and guide you through its most advanced features. You will find everything you need to become a TypeScript Expert — not
はじめに この記事は #EveOneZenn (Everyday One Zenn) vol.04 です。 TypeScript 4.1 で新たに追加された --noUncheckedIndexedAccess オプションを紹介します。 前回: --noUncheckedIndexedAccess オプション --noUncheckedIndexedAccess オプションは TypeScript 4.1 で追加された、プロパティへのアクセスをより厳密にするオプションです。 これまで --strictNullChecks オプションを有効にしていても、配列の要素やオブジェクトのプロパティへのアクセスが厳密な型安全ではありませんでした。 たとえば、次のコードでは JavaScript 的に undefined の可能性があるプロパティへアクセスしても型情報としては undefined が含ま
TypeScript/JavaScriptの言語思想的にはtry/catchを使ってerror handlingをするのが普通
React TypeScript CheatsheetsCheatsheets for experienced React developers getting started with TypeScript
GraphQL Code Generator (a.k.a. graphql-codegen) のプラグインとして graphql-codegen-typescript-validation-schema (Star ください!) を利用すると yup や zod といったフロントエンド validation 用の schema も自動で生成できます。 例えばこのような GraphQL Schema を与えます。ここで記述している constraint directive は confuser/graphql-constraint-directive で提供されているものを想定してます。 input ExampleInput { email: String! @required(msg: "Hello, World!") @constraint(minLength: 50, format:
CSS + superpowers - bloat. How Stylex creates a zero-cost abstraction that gives CSS superpowers. If you like what we do please consider subscribing → https://bit.ly/3lowyCt --- This event would not take place without the support of our sponsors: ## Gold Sponsors * Gofore → https://gofore.com * Futurice → https://www.futurice.com * Smartly → https://www.smartly.io ## Silver Spo
利用しているライブラリのアップデートは常に行いたいが、中々コストの掛かる作業でもある。その時にテストが通ったらOK・型検証が通ったらOKみたいなライブラリ(例: TypeScriptなら @types/系やjestなど)なら人間の目を通さずに自動でPullRequestをマージしてくれたら、その分コストが減り、人間の目が必要な作業を行う時間が増える。 そこでRenovateを使って上記のようなことをやってみたのでメモしておく。 出来たもの https://github.com/shibayu36/typescript-cli-project/pull/10 のように、Renovateのbotが勝手にPRを作り、勝手にApproveし、テストが通ったら(GitHubのchecksが通ったら)勝手にマージしてくれるようになった。 実現するためにやること Renovateを有効にして、自動マージ
create-validator-tsというTypeScriptの型定義からJSON Schemaを使ったバリデーションコードを生成するツールを書きました。 モチベーション expressなどでAPIを書くときに、Request/Responseが意図したものかどうかをバリデーションする必要があります。 特にreq.queryなどはStringが入ると予想しますが、オブジェクトが入ってくることもあります。 これは、expressの内部で使っているqsというURLクエリのパーサが、オブジェクトや配列へ展開する機能を持っているためです。 expressを使ってるサイトは ?q=text があるときに req.query.q には オブジェクトが入る可能性をちゃんと考慮しないといけない。 ?q[a]=text で req.query.q ; // { a: "text" } になる — azu
LINE株式会社は、2023年10月1日にLINEヤフー株式会社になりました。LINEヤフー株式会社の新しいブログはこちらです。 LINEヤフー Tech Blog こんにちは。LINE Growth Technology UITチームの慶島(@pittanko_pta)です。 この記事では、TypeScriptのenumを使わないほうがいい理由を、Tree-shakingの観点で紹介します。 検証環境 TypeScriptからJavaScriptへのトランスパイルは https://www.typescriptlang.org/play (TypeScript 3.9.2 / targetはESNext) で行いました。 Tree-shaking の挙動については https://rollupjs.org/repl/ にトランスパイルしたJavaScriptコードを貼り付けて検証しました
フロントエンドエンジニアの今村です。TypeScriptではenumを使わずunion型を使いましょう、という話を書きます。 モチベーション 何を今さら、と思う方もいるかもしれません。 TypeScriptのunion型はenum的なものを表現可能であり、基本的にenumよりもunion型を使うべき、という意識を持っているTypeScriptプログラマーはすでに少なからずいるのではないかと思います。しかし、ではenumの使用はいかなる場合も避けるべきなのか、そうでないとしたらどのような基準でenumとunion型を使い分けるべきなのか、といった点について、広く合意の取れたガイドラインはなさそうです(少なくとも私は知りません)。この結果、コードレビューなどで少しやりづらさを感じることがあったので、白黒つけてしまいたいという気持ちからこのブログを書いています。 結論としては、enumは全面的に
Today we’re excited to announce the final release of TypeScript 2.0! TypeScript 2.0 has been a great journey for the team, with several contributions from the community and partners along the way. It brings several new features that enhance developer productivity, advances TypeScript’s alignment with ECMAScript’s evolution, provides wide support for JavaScript libraries and tools, and augments the
第7章 型定義ファイルを作成する 第6章「JavaScriptの資産と@types」で型定義ファイルの取得方法、使い方を学びました。しかし、世の中にあるJavaScriptライブラリのうち、型定義ファイルが書かれていないものはまだまだあります。特に、門外不出の社内ライブラリなどは誰も手をつけて(いるわけが)ない前人未到の地です。 しからば!自分で書くしかあるまいよ!ぶっちゃけた話、めんどくさいのですが、後々の安心・安全を得るための投資として割りきりましょう。 なお、自分で型定義ファイルを1行も書かずにTypeScriptをやると、どこかの時点で不便に感じるでしょう。最初のうちは無理かもしれませんが、まずは人が書いた型定義ファイルを読んで知識を蓄え、この世界に入ってきてくれると嬉しいです。 7.1 型、実体、そして42。 TypeScriptはJavaScriptに対して後付で型による制約を
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く