Skip to content

Cannot use croner along with this package as Cron function not exported (The inferred type of ... cannot be named without a reference to '@elysiajs/cron/node_modules/croner') #54

@recanman

Description

@recanman

When I try to use croner (a dependency) along with @elysiajs/cron, I get this type error:

The inferred type of ... cannot be named without a reference to '@elysiajs/cron/node_modules/croner'. This is likely not portable. A type annotation is necessary.ts(2742)

This is expected, as the package depends on the return type of the Cron function from croner.

Here is the patch I'm using at the moment:

diff --git a/dist/index.d.ts b/dist/index.d.ts
index 0bb13ca04b916b86c783b1d14e8699d957bb6743..89f94bf6079e0a61de0410e61aefe272d3beb17c 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -1,5 +1,7 @@
 import { Elysia } from 'elysia';
 import { Cron, type CronOptions } from 'croner';
+export {Cron as __cron}
+
 export interface CronConfig<Name extends string = string> extends CronOptions {
     /**
      * Input pattern, input date, or input ISO 8601 time string

I am not sure whether this is the best approach. As such, I created an issue, not a PR. Would appreciate some feedback on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions