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

Types are incorrect when using es6 iterator flag #175

Closed
wj-eurostar opened this issue Nov 18, 2019 · 2 comments
Closed

Types are incorrect when using es6 iterator flag #175

wj-eurostar opened this issue Nov 18, 2019 · 2 comments
Labels

Comments

@wj-eurostar
Copy link

wj-eurostar commented Nov 18, 2019

When using the flag iterator: true the value returned by the iterator does not match the typescript types.

For this code:

const interval = parser.parseExpression('*', {
    currentDate,
    endDate,
    iterator: true
});
cost obj = interval.next().value;

The following error is shown.
Property 'value' does not exist on type 'CronDate'.

The methods such as toString, toDate etc are only accessible through interval.next().value.toString, interval.next().toDate when using this flag.

@tobiasjeckel
Copy link

Anyone know a fix or workaround? Thanks

@harrisiirak
Copy link
Owner

This library isn't currently supporting ES6 style iterators (neither the parser is compatible with it), therefore next() isn't returning correct iterator as you could expect.

The best you can do at this point: cost obj = interval.next() as IteratorResult<CronDate>

See #82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants