特定のキーを除く型(Omitをネストさせる)

type NestedOmit<T, K extends keyof T> = { [P in keyof Omit<T, K>]: T[P] extends Array<infer R> ? K extends keyof R ? Array<NestedOmit<R, K>> : Array<R> : K extends keyof T[P] ? NestedOmit<T[P], K> : T[P] }; 例えばレシピとその材料を表す以下のinterfaceがあったとき interface Recipe { id: number; name: strin</t[p],></r></nestedomit<r,></infer></t,></t,>…

GAEでcronを使って定時実行処理をする

定期的に処理を実行したいときがありますね。GAEはcronの設定ができます。 cron設定 アプリケーションのルートディレクトリにcron.yamlファイルを作成します。中身はこんな感じ // cron.yaml cron: - description: "ゴミ出し通知" url: /cron schedule: ever…

React useContextとemotion-themingを使ってテーマ切り替え機能を実装する🌔

emotion-themingを利用して、テーマ切り替え機能を実装します。Twitterのと一緒です。ボタン押して、toggleできるものを目指します。 Install とりあえず npx create-react-app dark-mode --typescript emotion yarn add @emotion/core @emotion/styled emot…

ExpressをTypescriptで書く

インストール Express, Typescript, webpackをインストール yarn add express yarn add -D @types/express typescript ts-loader webpack webpack-cli ファイルの変更を検知してnode再起動してくれる nodemon をインストール yarn add -D nodemon Webpackの…

Webpackとは(今更)

いつもなんとなくでググって出てくるものをコピペしてたので、自分で構成できるよう、調べた。 Webpack? webpack is a static module bundler for modern JavaScript applications. https://webpack.js.org/concepts/ module bundler? モジュールをまとめ…

今日から。

いままで技術系のアウトプットを(公開されているところで)したことがなかったので、今日から始める。 毎日は難しいかもしれないが、技術的につまずいたこと、調べたことはどんどん残していく。