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

[v4.0.0-beta.13] ion-datetime PickerOptions interface requires columns key #16095

Closed
simonhaenisch opened this issue Oct 25, 2018 · 1 comment · Fixed by #16101
Closed

[v4.0.0-beta.13] ion-datetime PickerOptions interface requires columns key #16095

simonhaenisch opened this issue Oct 25, 2018 · 1 comment · Fixed by #16101
Assignees

Comments

@simonhaenisch
Copy link
Contributor

Bug Report

Ionic Info

"@ionic/core": "4.0.0-beta.13"

Describe the Bug

When setting the picker options for an ion-datetime, the PickerOptions interface requires a columns key, which is actually not required according to the examples:

https://github.com/ionic-team/ionic/blob/44b0eaba8514730a61a8f79561fcd4b219358155/core/src/components/datetime/test/preview/index.html#L152-L165

Related Code

<ion-datetime
  pickerOptions={{
    buttons: [{ text: 'Cancel' }, { text: 'Done', handler: console.log }],
  }}
/>

Type '{ buttons: ({ text: string; } | { text: string; handler: (val: any) => void; })[]; }' is not assignable to type 'PickerOptions'.
Property 'columns' is missing in type '{ buttons: ({ text: string; } | { text: string; handler: (val: any) => void; })[]; }'.

Interface comes from here:

https://github.com/ionic-team/ionic/blob/44b0eaba8514730a61a8f79561fcd4b219358155/core/src/components/picker/picker-interface.ts#L3-L16

Expected Behavior

Maybe change it to columns?: PickerColumn[]?

Additional Context

As a workaround, one can either add an empty columns array or set the options type to any (but using the latter means losing intellisense):

<ion-datetime
  pickerOptions={{
    buttons: [{ text: 'Cancel' }, { text: 'Done', handler: console.log }],
    columns: [],
  }}
/>
<ion-datetime
  pickerOptions={
    {
      buttons: [{ text: 'Cancel' }, { text: 'Done', handler: console.log }],
    } as any
  }
/>
@ionitron-bot
Copy link

ionitron-bot bot commented Nov 25, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants