Merged
Conversation
harsssh
commented
Nov 21, 2024
| "lint": "biome check", | ||
| "lint:fix": "biome check --fix" | ||
| "lint:fix": "biome check --fix", | ||
| "watch:server-types": "tsc -b -w ./src/server" |
Collaborator
Author
There was a problem hiding this comment.
ソースコードを更新したら再コンパイルが必要なので、tsc --watch で更新が必要です
harsssh
commented
Nov 21, 2024
Comment on lines
+5
to
+6
| "composite": true, | ||
| "declaration": true, |
Collaborator
Author
There was a problem hiding this comment.
project reference の設定に必須です
https://www.typescriptlang.org/docs/handbook/project-references.html#composite
harsssh
commented
Nov 21, 2024
| "declarationMap": true, | ||
| "emitDeclarationOnly": true, | ||
| "outDir": "./types", | ||
| "rootDir": "../" |
Collaborator
Author
There was a problem hiding this comment.
サーバーのコードが src/db など、親ディレクトリのものを参照するので必要です
harsssh
commented
Nov 21, 2024
| "paths": { | ||
| "@/*": ["./src/*"] | ||
| }, | ||
| "skipLibCheck": true, |
Collaborator
Author
There was a problem hiding this comment.
依存パッケージで型エラーが起きたりするので、チェックを無効化
harsssh
commented
Nov 21, 2024
| }, | ||
| "noUncheckedIndexedAccess": true | ||
| } | ||
| "disableSourceOfProjectReferenceRedirect": true |
Collaborator
Author
There was a problem hiding this comment.
project reference とこのオプションを有効化すると、型情報はコンパイルした *.d.ts を参照するようになる。
詳しくは以下の PR のコメントを参照。
harsssh
commented
Nov 21, 2024
| "type": "module", | ||
| "scripts": { | ||
| "dev": "vite dev", | ||
| "dev": "concurrently -r -k yarn:watch:server-types vite", |
Collaborator
Author
There was a problem hiding this comment.
-r, --raw は余計な prefix などを付けない、-k, --kill-others はどれかが終了したら全て終了させる。
Collaborator
Author
|
|
Collaborator
Author
問題なさそう |
smatsuodev
approved these changes
Nov 27, 2024
| "declaration": true, | ||
| "declarationMap": true, | ||
| "emitDeclarationOnly": true, | ||
| "outDir": "./types", |
Owner
smatsuodev
approved these changes
Nov 27, 2024
smatsuodev
approved these changes
Nov 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hono のドキュメントにもあるとおり、型を事前にコンパイルするとクライアントの補完が早くなる。
TypeScript の Project References を使う方法を採用した。
https://hono.dev/docs/guides/rpc#compile-your-code-before-using-it-recommended
設定は面倒ですが、これくらい爆速になります。
fast-hono.mov
詳細はコメントで補足します。