Skip to content

Commit 386a7e6

Browse files
committed
Add back run identifier type definition
1 parent 339746b commit 386a7e6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ declare module 'replicate' {
5858

5959
export type Training = Prediction;
6060

61+
type RunIdentifier = `${string}/${string}:${string}`;
62+
6163
interface RunOptions {
6264
input: any;
6365
wait?: {
@@ -87,8 +89,8 @@ declare module 'replicate' {
8789
fetch: Function;
8890

8991

90-
run(identifier: string, options: RunOptions & { stream: true }): Promise<AsyncIterable<any>>;
91-
run(identifier: string, options: RunOptions): Promise<object>;
92+
run(identifier: RunIdentifier, options: RunOptions & { stream: true }): Promise<AsyncIterable<any>>;
93+
run(identifier: RunIdentifier, options: RunOptions): Promise<object>;
9294

9395
request(route: string, parameters: any): Promise<any>;
9496
paginate<T>(endpoint: () => Promise<Page<T>>): AsyncGenerator<[ T ]>;

index.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,12 @@ describe('Replicate client', () => {
558558

559559
await expect(client.run('owner/model:invalid', options)).rejects.toThrow();
560560

561+
// @ts-expect-error
561562
await expect(client.run('owner:abc123', options)).rejects.toThrow();
562563

563564
await expect(client.run('/model:abc123', options)).rejects.toThrow();
564565

566+
// @ts-expect-error
565567
await expect(client.run(':abc123', options)).rejects.toThrow();
566568
});
567569

0 commit comments

Comments
 (0)