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

Type 'number[]' is not assignable to type 'DateArray' #138

Closed
chrysb opened this issue May 20, 2020 · 3 comments
Closed

Type 'number[]' is not assignable to type 'DateArray' #138

chrysb opened this issue May 20, 2020 · 3 comments

Comments

@chrysb
Copy link

chrysb commented May 20, 2020

Thanks for making this!

I'm unable to get the example code to work in TypeScript.

const event = {
  start: [2018, 5, 30, 6, 30]
}

I also tried

const start = moment(startsAt)
    .format('YYYY-M-D-H-m')
    .split('-')

(which btw returns an array of strings)

And seeing your type definition is [number, number, number, number, number], I'm having trouble getting them to match up.

Why not just use an isoString in the first place for the start and end properties?

@robertpatan
Copy link

I have the same issue.
I used: start: [momentDate.year(), (momentDate.month() + 1), momentDate.date(), momentDate.hour(), momentDate.minute()] . Even just puting [1,2,3,4,5] doesn't work.
The dts file seems to be maybe based on a older version of ts?
Type 'number[]' is not assignable to type 'DateArray'. Even after correcting this, you will get another ts error at status.
Anyway I ended up using
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore // @ts-ignore

@adamgibbons
Copy link
Owner

adamgibbons commented Jul 30, 2020

The TS declaration file was contributed to the project by a TS developer. I'm happy to review a PR to update it.

@adamgibbons
Copy link
Owner

I believe this should be fixed by #155.

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

No branches or pull requests

3 participants