# @types/node-cron

> TypeScript definitions for node-cron

Latest version **3.0.11** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/node-cron
pnpm add @types/node-cron
yarn add @types/node-cron
bun add @types/node-cron
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.11 |
| Published | 2023-11-07 |
| First published | 2018-01-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51438 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/node-cron
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-cron
- npm.io page: https://npm.io/package/@types/node-cron

## Recent versions

- 3.0.11 (latest) — 2023-11-07
- 3.0.8 (ts4.3) — 2023-06-24
- 3.0.7 (ts4.2) — 2022-12-28
- 3.0.6 (ts4.1) — 2022-11-14
- 3.0.2 (ts4.0) — 2022-06-30
- 3.0.1 (ts3.8) — 2022-01-02
- 3.0.0 (ts3.7) — 2021-10-01
- 2.0.4 (ts3.6) — 2021-07-07
- 2.0.3 (ts2.8) — 2020-02-10
- 2.0.2 (ts2.0) — 2019-04-10
- 2.0.8 — 2023-11-07
- 2.0.7 — 2023-10-18
- 3.0.10 — 2023-10-18
- 2.0.6 — 2023-09-23
- 3.0.9 — 2023-09-23
- … 7 more at https://npm.io/package/@types/node-cron/versions

## README

# Installation
> `npm install --save @types/node-cron`

# Summary
This package contains type definitions for node-cron (https://github.com/node-cron/node-cron).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-cron.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-cron/index.d.ts)
````ts
import { EventEmitter } from "events";

/**
 * Creates a new task to execute the given function when the cron expression ticks.
 * @param cronExpression
 * @param func
 * @param options
 */
export function schedule(
    cronExpression: string,
    func: ((now: Date | "manual" | "init") => void) | string,
    options?: ScheduleOptions,
): ScheduledTask;

/**
 * To validate whether the expression is a cron expression or not
 * @param cronExpression
 */
export function validate(cronExpression: string): boolean;

/**
 * Get the list of tasks created using the `schedule` function
 */
export function getTasks(): Map<string, ScheduledTask>;

export interface ScheduledTask extends EventEmitter {
    now: (now?: Date) => void;
    start: () => void;
    stop: () => void;
}

export interface ScheduleOptions {
    /**
     * A boolean to set if the created task is scheduled.
     *
     * Defaults to `true`
     */
    scheduled?: boolean | undefined;
    /**
     * The timezone that is used for job scheduling
     */
    timezone?: string;
    /**
     * Specifies whether to recover missed executions instead of skipping them.
     *
     * Defaults to `false`
     */
    recoverMissedExecutions?: boolean;
    /**
     * The schedule name
     */
    name?: string;
    /**
     * Execute task immediately after creation
     */
    runOnInit?: boolean;
}

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 20:08:00 GMT
 * Dependencies: none

# Credits
These definitions were written by [morsic](https://github.com/maximelkin), [burtek](https://github.com/burtek), [Richard Honor](https://github.com/RMHonor), [Ata Berk YILMAZ](https://github.com/ataberkylmz), [Alex Seidmann](https://github.com/aseidma), and [Pedro Américo](https://github.com/ghostebony).

---
_Source: https://npm.io/package/@types/node-cron · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
