bluesky-social / atproto

Social networking technology created by Bluesky
Other
6.88k stars 486 forks source link

Types in @atproto/api are broken #3048

Open nzakas opened 2 days ago

nzakas commented 2 days ago

Describe the bug

The types in @atproto/api appear to be missing some references.

To Reproduce

Steps to reproduce the behavior:

  1. Start a new TypeScript project
  2. Install @atproto/api
  3. Add a sample file using AtpAgent
  4. Run npx tsc to run the TypeScript compiler

Repro case: https://stackblitz.com/edit/stackblitz-starters-tg3qyc?file=tsconfig.json

Run npx tsc on the command line.

Expected behavior

Project should compile without errors.

Actual Behavior

I get the following errors:

$ npx tsc
node_modules/@atproto/xrpc/dist/client.d.ts:11:85 - error TS2304: Cannot find name 'BodyInit'.

11     call(serviceUri: string | URL, methodNsid: string, params?: QueryParams, data?: BodyInit | null, opts?: CallOptions): Promise<import("./types").XRPCResponse>;       

 ~~~~~~~~

node_modules/@atproto/xrpc/dist/util.d.ts:9:65 - error TS2304: Cannot find name 'HeadersInit'.

9 export declare function combineHeaders(headersInit: undefined | HeadersInit, defaultHeaders?: Iterable<[string, undefined | Gettable<null | string>]>): undefined | HeadersInit;

                       ~~~~~~~~~~~

node_modules/@atproto/xrpc/dist/util.d.ts:9:165 - error TS2304: Cannot find name 'HeadersInit'.

9 export declare function combineHeaders(headersInit: undefined | HeadersInit, defaultHeaders?: Iterable<[string, undefined | Gettable<null | string>]>): undefined | HeadersInit;

                                     ~~~~~~~~~~~

node_modules/@atproto/xrpc/dist/util.d.ts:10:62 - error TS2304: Cannot find name 'BodyInit'.

10 export declare function isBodyInit(value: unknown): value is BodyInit;

                     ~~~~~~~~

node_modules/@atproto/xrpc/dist/util.d.ts:12:81 - error TS2304: Cannot find name 'BodyInit'.

12 export declare function encodeMethodCallBody(headers: Headers, data?: unknown): BodyInit | undefined;

                                        ~~~~~~~~

Found 5 errors in 2 files.

Errors  Files
     1  node_modules/@atproto/xrpc/dist/client.d.ts:11
     4  node_modules/@atproto/xrpc/dist/util.d.ts:9

Details

Additional context