Closed 0xd3e closed 1 year ago
Describe the bug
The TypeScript Language Server shows errors when calling createPromiseClient(). The generated service is not assignable.
createPromiseClient()
Diagnostics: 1. Type 'PromiseClient<ServiceType>' is missing the following properties from type 'PromiseClient<{ readonly typeName: "workplus.account.v1alpha1.AccountService"; readonly methods: { readonly createAccount: { readonly name: "CreateAccount "; readonly I: typeof CreateAccountRequest; readonly O: typeof CreateAccountResponse; readonly kind: any; }; readonly generateTemporaryPassword: { ...; }; readonly...': createAccount, generateTemporaryPassword, signIn 2. Argument of type '{ readonly typeName: "workplus.account.v1alpha1.AccountService"; readonly methods: { readonly createAccount: { readonly name: "CreateAccount"; readonly I: typeof CreateAccountRequest; readonly O: typeof CreateAccountR esponse; readonly kind: any; }; readonly generateTemporaryPassword: { ...; }; readonly signIn: { ......' is not assignable to parameter of type 'ServiceType'.
To Reproduce
import { AccountService } from "pb/workplus/account/v1alpha1/service_connectweb" import { createPromiseClient, createConnectTransport } from "@bufbuild/connect-web" import type { PromiseClient } from '@bufbuild/connect-web' interface API { account: PromiseClient<typeof AccountService> } const transport = createConnectTransport({ baseUrl: "localhost:50100" }) export const api: API = { account: createPromiseClient(AccountService, transport) }
Environment (please complete the following information):
It works now. It seems that I missed to install @bufbuild/protobuf.
@bufbuild/protobuf
Describe the bug
The TypeScript Language Server shows errors when calling
createPromiseClient()
. The generated service is not assignable.To Reproduce
Environment (please complete the following information):