- Created: 2024-07-28
- Updated: https://gist.github.com/azu/ac5dafbf211ef8b5ecf386930ac75250/revisions
Node.jsのTypeScriptサポートに関する議論を時系列でまとめたものです。
Node.jsのTypeScriptサポートに関する議論を時系列でまとめたものです。
export type BaseEnvRecord = Record< | |
string, | |
{ | |
value: string | undefined; | |
required: boolean; | |
defaultValue?: string; | |
} | |
>; | |
export type ReturnTypeOfCreateEnv<T extends BaseEnvRecord> = { | |
// If the value is required, it should be a string, otherwise it should be a string or undefined |
{ | |
// ベースのtsconfigは決められたカテゴリのみを設定する | |
// それ以外は、プロジェクトごとに設定する | |
// https://www.typescriptlang.org/tsconfig/#compilerOptions | |
"compilerOptions": { | |
// incrementalビルドは特別にデフォルトで有効にする | |
"incremental": true, | |
// # JavaScript Support | |
"allowJs": false, | |
// # Type Checking |
import React, { useActionState } from "react"; | |
const validate = _ => {}; | |
const isValidationError = _ => {}; | |
const isNetworkError = _ => {}; | |
const DisplayError = ({ | |
error, | |
}: { | |
error: ReturnType<typeof usePage>["error"]; | |
}) => { | |
if(isValidationError(error)) { |
const draw = (output) => console.log(output); | |
const getWeather = async (city) => { | |
await new Promise((resolve) => setTimeout(resolve, 1000)); | |
return "sunny"; | |
}; | |
const render = async function* ({ city }) { | |
yield `<Spinner />`; | |
const weather = await getWeather(city); | |
return `<Weather info=${weather} />`; |
api.mapkey("g", "Kagi to Google", function () { | |
const isKagi = location.href.startsWith("https://kagi.com/search?"); | |
if (isKagi) { | |
location.href = `https://www.google.com/search?q=${(new URL(location.href)).searchParams.get("q")}`; | |
} | |
}); |
Ref なぜ僕は公式ドキュメントを読むのが苦手なのか #初心者 - Qiita
次のようなセクションがあった場合、何を読むかというのはその目的によって異なるという印象。
# 📝 [Note] Mode -- if commit message starts with "📝" or includes "[Note]" | |
IS_NOTE_MODE=$(git log -1 --pretty=%B | grep -E '^(📝|\[Note\])') | |
if [[ -n "${IS_NOTE_MODE}" ]]; then | |
# メモの作業内容を戻すコミットをする | |
headSHA=$(git rev-parse HEAD) | |
git revert --no-commit HEAD | |
git ls-tree -r --name-only HEAD | xargs git commit -m "↩️ ${headSHA}" -- | |
# メモを書く直前の状態に作業内容を戻す | |
git revert --no-commit HEAD | |
# terminal notification |
SQLサーバから別のところに侵入するパターンで、SQLサーバ上でOSのコマンドを利用してるケースが増えている。 各SQLサーバでOSコマンドを実行する方法を知りたい。
Type | How To | Status |
---|---|---|
SQL Server | xp_cmdshell |
Disable by Default |
MySQL | system (\!) |
Enable in Terminal |
PostgreSQL | COPY |
Require pg_execute_server_program role |