-
Notifications
You must be signed in to change notification settings - Fork 10
Fix/build errors - flux-client.ts #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -28,7 +28,7 @@ export class FluxClient { | |||||
| }, | ||||||
| }); | ||||||
|
|
||||||
| this.client = await createGrpcClient(GRPC_SERVER_ADDRESS, clientImpl); | ||||||
| this.client = (await createGrpcClient(GRPC_SERVER_ADDRESS, clientImpl)) as unknown as Awaited<ReturnType<typeof createGrpcClient>>; | ||||||
| console.log(`[FLUX] Connected to server at ${GRPC_SERVER_ADDRESS}`); | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -49,7 +49,8 @@ export class FluxClient { | |||||
| if (!this.client) return; | ||||||
|
|
||||||
| (async () => { | ||||||
| for await (const [message] of this.client!.FluxService.messageStream) { | ||||||
| const stream = this.client!.FluxService.messageStream; | ||||||
| for await (const [message] of stream as AsyncIterable<[IncomingMessage | { ack: string }]>) { | ||||||
|
||||||
| for await (const [message] of stream as AsyncIterable<[IncomingMessage | { ack: string }]>) { | |
| for await (const message of stream as AsyncIterable<IncomingMessage | { ack: string }>) { |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,4 +182,4 @@ async function main() { | |
| } | ||
| } | ||
|
|
||
| main().catch(console.error); | ||
| main().catch(console.error); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type assertion is redundant and potentially problematic. The expression casts the result of
createGrpcClienttoAwaited<ReturnType<typeof createGrpcClient>>, which is the same type it already returns. Usingas unknown asto cast something to its own type suggests a workaround for a type system issue that should be addressed differently.Looking at line 9, the
clientproperty is already typed asAwaited<ReturnType<typeof createGrpcClient>> | null, andauth.tsusescreateGrpcClientwithout any type assertions (lines 80, 88, 113, 170, 187). The assertion should be removed entirely, allowing TypeScript to infer the correct type naturally.