0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ts filter 型ガード

Last updated at Posted at 2022-08-28

filter使用時の型ガードは以下のようにして指定
もし、includeを使う場合は型アサーションを使う

type User = {id: number, name: string, type: string};

users.filter(user is User => {allUser.include(user as User)})
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?