Skip to content
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

Error when compiling: issues in connection.ts and fetch-impl.ts #21

Open
trialexperiment opened this issue Mar 24, 2024 · 1 comment
Open

Comments

@trialexperiment
Copy link

Hi, I am having errors when trying to run the examples, is the sdk broken on a certain version of a package?

Output:
src/sdk/rpc/connection.ts:38:20 - error TS2614: Module '"./fetch-impl"' has no exported member 'Response'. Did you mean to use 'import Response from "./fetch-impl"' instead?

38 import fetchImpl, {Response} from './fetch-impl';
~~~~~~~~

src/sdk/rpc/connection.ts:264:5 - error TS2322: Type '(info: RequestInfo | URL, init: RequestInit) => Promise<Response | Response>' is not assignable to type '(input: RequestInfo | URL, init?: RequestInit) => Promise'.
Type 'Promise<Response | Response>' is not assignable to type 'Promise'.
Type 'Response | Response' is not assignable to type 'Response'.
Property 'formData' is missing in type 'import("/Users/admin/Documents/Documents/Projects/solanastuff/jito-ts/node_modules/@types/node-fetch/index").Response' but required in type 'Response'.

264 fetchWithMiddleware = async (info, init) => {
~~~~~~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.dom.d.ts:3159:5
3159 formData(): Promise;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'formData' is declared here.

src/sdk/rpc/connection.ts:276:26 - error TS2345: Argument of type 'RequestInfo | URL' is not assignable to parameter of type '(RequestInfo | URL) & RequestInfo'.
Type 'Request' is not assignable to type '(RequestInfo | URL) & RequestInfo'.
Type 'Request' is not assignable to type '(string & Request) | (Request & string) | (Request & URLLike) | (Request & Request) | (URL & Request)'.
Type 'Request' is not assignable to type 'Request & Request'.
Type 'Request' is missing the following properties from type 'Request': context, compress, counter, follow, and 6 more.

276 return await fetch(...modifiedFetchArgs);
~~~~~~~~~~~~~~~~~~~~

src/sdk/rpc/connection.ts:385:45 - error TS2339: Property 'commitment' does not exist on type 'Commitment | ConnectionConfig'.
Property 'commitment' does not exist on type '"finalized"'.

385 this._commitment = commitmentOrConfig.commitment;
~~~~~~~~~~

src/sdk/rpc/connection.ts:387:28 - error TS2339: Property 'confirmTransactionInitialTimeout' does not exist on type 'Commitment | ConnectionConfig'.
Property 'confirmTransactionInitialTimeout' does not exist on type '"finalized"'.

387 commitmentOrConfig.confirmTransactionInitialTimeout;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/sdk/rpc/connection.ts:388:40 - error TS2339: Property 'httpHeaders' does not exist on type 'Commitment | ConnectionConfig'.
Property 'httpHeaders' does not exist on type '"finalized"'.

388 httpHeaders = commitmentOrConfig.httpHeaders;
~~~~~~~~~~~

src/sdk/rpc/connection.ts:389:34 - error TS2339: Property 'fetch' does not exist on type 'Commitment | ConnectionConfig'.
Property 'fetch' does not exist on type '"finalized"'.

389 fetch = commitmentOrConfig.fetch;
~~~~~

src/sdk/rpc/connection.ts:390:44 - error TS2339: Property 'fetchMiddleware' does not exist on type 'Commitment | ConnectionConfig'.
Property 'fetchMiddleware' does not exist on type '"finalized"'.

390 fetchMiddleware = commitmentOrConfig.fetchMiddleware;
~~~~~~~~~~~~~~~

src/sdk/rpc/connection.ts:391:52 - error TS2339: Property 'disableRetryOnRateLimit' does not exist on type 'Commitment | ConnectionConfig'.
Property 'disableRetryOnRateLimit' does not exist on type '"finalized"'.

391 disableRetryOnRateLimit = commitmentOrConfig.disableRetryOnRateLimit;
~~~~~~~~~~~~~~~~~~~~~~~

src/sdk/rpc/connection.ts:392:38 - error TS2339: Property 'httpAgent' does not exist on type 'Commitment | ConnectionConfig'.
Property 'httpAgent' does not exist on type '"finalized"'.

392 httpAgent = commitmentOrConfig.httpAgent;
~~~~~~~~~

Found 10 errors in the same file, starting at: src/sdk/rpc/connection.ts:38

@Tangdixi
Copy link

Tangdixi commented Mar 30, 2024

change export * from 'node-fetch';
to export { Response } from 'node-fetch'; in fetch-impl.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants