breejs / bree

Bree is a Node.js and JavaScript job task scheduler with worker threads, cron, Date, and human syntax. Built for @ladjs, @forwardemail, @spamscanner, @cabinjs.
https://jobscheduler.net
MIT License
3.01k stars 78 forks source link

[fix] Typescript type errors in the package #146

Closed feralheart closed 2 years ago

feralheart commented 2 years ago

Describe the bug

Actual behavior

I've added this package to my typescript project and upon building I've got these errors:

node_modules/bree/types/index.d.ts:3:30 - error TS2307: Cannot find module 'node:events' or its corresponding type declarations.

3 import { EventEmitter } from 'node:events';

node_modules/bree/types/index.d.ts:4:39 - error TS2307: Cannot find module 'node:worker_threads' or its corresponding type declarations.

4 import { WorkerOptions, Worker } from 'node:worker_threads';

Expected behavior

No type errors inside the package

Checklist

shadowgate15 commented 2 years ago

@feralheart Do you have @types/node installed as a dev dependency?

arimus commented 2 years ago

Looks like this is due to old @types/node definitions being installed in my case. Updated to the 16.x release and that solved this issue for me.