- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.7k
Closed
Labels
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
7.94.1
Framework Version
No response
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
I try the example given at
https://docs.sentry.io/platforms/node/crons/#cron
For my project in typescript. Using the latest versions of both cron and @sentry/node
import * as Sentry from "@sentry/node";
import { CronJob } from "cron";
const CronJobWithCheckIn = Sentry.cron.instrumentCron(
  CronJob,
  "my-cron-job"
);However I get a Type error as the type expected by instrumentCron does not match the actual one from CronJob:
 error TS2345: Argument of type 'typeof CronJob' is not assignable to parameter of type 'typeof CronJob & CronJobConstructor'.
         Type 'typeof CronJob' is not assignable to type 'CronJobConstructor'.
           Types of property 'from' are incompatible.
             Type '<OC extends CronOnCompleteCommand | null = null, C = null>(params: CronJobParams<OC, C>) => CronJob<OC, C>' is not assignable to type '(param: CronJobParams) => CronJob'.
               Types of parameters 'params' and 'param' are incompatible.
                 Type 'CronJobParams' is not assignable to type 'CronJobParams<() => void | Promise<void>, unknown>'.
                   Type 'CronJobParams' is not assignable to type 'BaseCronJobParams<() => void | Promise<void>, unknown> & { timeZone?: undefined; utcOffset?: number | null | undefined; }'.
                     Type 'CronJobParams' is not assignable to type '{ timeZone?: undefined; utcOffset?: number | null | undefined; }'.
                       Types of property 'timeZone' are incompatible.
                         Type 'string | undefined' is not assignable to type 'undefined'.
                           Type 'string' is not assignable to type 'undefined'.
From the error description it seems CronJobConstructor.from is not correctly defined.
Expected Result
Example from the documentation should be working.
Actual Result
Does not work :(
Metadata
Metadata
Assignees
Labels
Projects
Status
No status