Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ‘¨β€πŸ’» Add types declaration file #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

climba03003
Copy link

Closes #17

It should be good for the initial types.
I do not change the package.json since this package provide both cjs and esm.
Having the types field may get things weird in types resolving.
.d.cts should match .cjs and .d.ts should match .js automatically.

* @param {string} uid - Unique function (task) identification as a string
* @returns {Promise<string>} - Timer ID
*/
setInterval(func: Function, delay: number, uid: string): Promise<string>;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see some improvement can be done.
For example the cronjob function, task structure that added to database, etc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be strings like in case of Redis, or what do you mean exactly?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what I means is that the Function can be more specific in TypeScript.

The task: object can also be standardize to a proper struct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@climba03003 function<any|Promise<any>>?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be something like

(
  ready: (
    (next: Date) => void) | 
    ((callback: (err: Error, success: boolean) => void) => void)
  )
) => Promise<void> | void

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@climba03003

  1. Callback is gone
  2. Should include only ready

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@climba03003 lmk if it's good to go or we still want to change something

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmk if it's good to go or we still want to change something

Sorry for that late reply. A bit busy.

The current one is good to go.

@climba03003 climba03003 mentioned this pull request Apr 18, 2024
@climba03003 climba03003 changed the title πŸ‘¨β€πŸ’» Add types decoration file πŸ‘¨β€πŸ’» Add types declaration file Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript support
2 participants