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
// A: そのまま残る import { Foo } from "./foo"; // B: 識別子 `Foo` が削除される import {} from "./foo"; // C: import 文ごと完全に削除される どれになるかは、以下の状態の組み合わせ依存する(他にも条件あるかも)。 そのファイルでFooが値として参照されるか、型として参照されるか、参照されないか Fooがfoo.tsで値として定義されているか、型として定義されているか tsconfig のオプション設定 importsNotUsedAsValues: 値として参照されない import 文を残すかどうか preserveValueImports: 参照されない import 識別子が値なら残す isolatedModules: ファイル単位でトランスパイルする 上記は出力するモジュール形式が ESM の場合
// 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
Core Pipe<Input, Fn[]>: Pipes a type through several functions. PipeRight<Fn[], Input>: Pipe a type from right to left. Call<Fn, ...Arg>: Call a type level Fn function. Apply<Fn, Arg[]>: Apply several arguments to an Fn function. PartialApply<Fn, Arg[]>: Make an Fn partially applicable. Compose<Fn[]>: Compose Fn functions from right to left. ComposeLeft<Fn[]>: Compose Fn functions from left to rig
TypeScript as envisioned by Stable DiffusionThis article goes through almost all of the changes of the last 3 years (and some from earlier) in JavaScript / ECMAScript and TypeScript . Not all of the following features will be relevant to you or even practical, but they should instead serve to show what’s possible and to deepen your understanding of these languages. There are a lot of TypeScript fe
What Ezno is: A type checker for JavaScript usable through a CLI (with a LSP also in the works) Checks programs with guaranteed type safety (no runtime TypeErrors) (as long as definitions are sound) Types aimed at soundness and tracing for better static analysis A imperative type system that tracks and evaluates the side effects of functions and control flow structures. It is similar to an interpr
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
皆さんこんにちは。筆者は先日、TypeScript向けライブラリのts-array-lengthを公開しました。 この記事ではこのライブラリを宣伝するとともに、ライブラリの実装がどのようになっているのか解説します。 ts-array-lengthの機能 ts-array-lengthは3つの関数を提供しており、これらを使うことでなんと配列の要素数をチェックできます。 例えばhasLengthを使うと、配列の要素がちょうど2個かどうか調べることができます。 if (hasLength(arr, 2)) { // arrは2要素の配列! const [first, last] = arr; }
I've been working with TypeScript for a long long time. I think I'm not too bad at it. However, to my despair, some low-level behaviors still confuse me: Why does 0 | 1 extends 0 ? true : false evaluate to false? I'm very ashamed, but I sometimes confuse "subtype" and "supertype". Which is which? While we're at it, what are type "narrowing" and "widening", and how do they relate to sub/supertypes?
@captain-yossarian TypeScript blog, fully dedicated to static typings and type safety
Error handling in Type/JavaScript is a topic that doesn’t get the importance it deserves. It’s crucial to the longevity of any project to catch and log errors. As I’ve started working with TypeScript more over the years, I started to realize that I didn’t really understand error handling. I would often run into this problem: error is type unknown, so we can’t perform any actions with error until w
こんにちは、クレスウェア株式会社の奥野賢太郎 (@okunokentaro) です。本記事は『TypeScript 一人 Advent Calendar 2022』(TypeScript一人カレンダー) の目次と索引ページです。 本アドベントカレンダー内の各記事では、2022年12月、TypeScript 4.9の時点で解説しています。本アドベントカレンダーのすべての記事は、TypeScript初心者を脱し始めてもっと活用していきたいと願う読者層に向けていますので、最低限の前提は省略して記述しています。 目次 第1部 Conditional Types 1日目 ReturnType<T> Utility Types ReturnType<T> どんなときに便利? 例1 例2 注意点 2日目 Awaited<T> Awaited<T> どんなときに便利? 例1 例2 3日目 inferと実例
(Or, wait until the next nightly after this is merged.) How? The bulk of the work to convert the repo to modules is done via automation, followed by a load of changes by hand to completely restructure our build system. To see the conversion process, take a look at the commits in this PR, each of which come with their own descriptive commit message. In short, the typeformer project recreates our ol
型推論オプション 型推論の結果が変わるもの。 ⭐strict ... 以下のセット alwaysStrict strictNullChecks T | null や T | undefined が T に縮退しなくなる。 例 strictBindCallApply Function の各種メソッドが any に縮退しなくなる。 例 strictFunctionTypes コールバック関数の引数が共変でもunifyするようになる結果、型変数の推論優先度が変わることがある。 例 strictPropertyInitialization noImplicitAny 宣言型がない場合にflow typeが使われる機会が増える。 例 noImplicitThis thisの宣言型がない場合に文脈から型が決定される機会が増える。 例 useUnknownInCatchVariables catch (
For context, I'm the creator of the swc project and I previously announced that I would use Go for the new TypeScript type checker. Related: I'm porting tsc to Go Related: Status update of my tsc port I'm announcing two things about the new TypeScript type checker. I'll switch back to the Rust version# I was working on the Rust-based TypeScript type checker before switching to Go. But I decided to
Parser Type checking (as CLI and as library) Language Server Interactive type debugging Type information in other languages (optional) transpiling to JavaScript (optional) RTTI in JavaScript (optional) type profiler Additionally, making TypeScript type checking as fast as possible and providing a native library for other languages so they can use TypeScript type information without the need for a
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く