Waka blog.

  • Blog
  • About
  • Quotes
  • Sandbox
Description

waka.apps

富山在住のプログラマー。
フルリモートで働いています。

Blog
About
Quotes
Sandbox

#TypeScript

1件

2024年9月18日水曜日 8:25

[Typescript]配列の要素からundefinedを取り除くいくつかの方法

やりたいこと 以下のような配列があったとする const stringWithUndefinedArray = ["a", "b", undefined, "c", "d"]; この場合、 stringWithUndefinedArray の型は (string | undefined)[] となる。 この状態から string[] に変換したい。 ダメな例 単純に以下のようにfilter関数を呼び出しても型は (string | undefined)[] のまま変わらない。 const stringArray = stringWithUndefinedArray.filt
TypeScript
Description

waka.apps

富山在住のプログラマー。
フルリモートで働いています。

Categories

AWS

Cloudflare

Docker

Github

go

Google

html

JavaScript

microCMS

MySQL

Monthly Archives

2025/03 (1)

2025/01 (1)

2024/12 (4)

2024/11 (3)

2024/10 (1)

2024/09 (3)

2024/08 (7)

2024/07 (7)

2024/06 (4)

2024/05 (5)

2024/04 (6)

© 2025 Waka blog. All rights reserved.