Skip to content

Commit 9821d02

Browse files
authored
fix(sdk): Re-export schemaTask types to prevent the TypeScript error TS2742 (#2735)
Fixes this type of error when exporting a `schemaTask` in a monorepo: ``` error TS2742: The inferred type of 'helloWorldSchema' cannot be named without a reference to '@trigger.dev/core/v3'. This is likely not portable. ```
1 parent 255a73a commit 9821d02

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.changeset/light-donkeys-retire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
fix(sdk): Re-export schemaTask types to prevent the TypeScript error TS2742: The inferred type of 'task' cannot be named without a reference to '@trigger.dev/core/v3'. This is likely not portable.

packages/trigger-sdk/src/v3/shared.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
TaskRunExecutionResult,
2929
TaskRunPromise,
3030
} from "@trigger.dev/core/v3";
31-
import { PollOptions, runs } from "./runs.js";
3231
import { tracer } from "./tracer.js";
3332

3433
import type {
@@ -115,6 +114,10 @@ export type {
115114
TaskPayload,
116115
TaskRunResult,
117116
TriggerOptions,
117+
TaskWithSchema,
118+
TaskWithSchemaOptions,
119+
TaskSchema,
120+
TaskOptionsWithSchema,
118121
};
119122

120123
export { SubtaskUnwrapError, TaskRunPromise };

packages/trigger-sdk/src/v3/tasks.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ import type {
3939
TriggerOptions,
4040
TaskRunResult,
4141
TaskFromIdentifier,
42+
TaskWithSchemaOptions,
43+
TaskSchema,
44+
TaskWithSchema,
45+
TaskOptionsWithSchema,
4246
} from "./shared.js";
4347

4448
export type {
@@ -56,6 +60,10 @@ export type {
5660
TriggerOptions,
5761
TaskRunResult,
5862
TaskFromIdentifier,
63+
TaskWithSchemaOptions,
64+
TaskSchema,
65+
TaskWithSchema,
66+
TaskOptionsWithSchema,
5967
};
6068

6169
export type * from "./hooks.js";

0 commit comments

Comments
 (0)