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

Calendar d.ts marks all props as required #296

Closed
qwerty2k opened this issue Jan 27, 2018 · 1 comment
Closed

Calendar d.ts marks all props as required #296

qwerty2k opened this issue Jan 27, 2018 · 1 comment
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@qwerty2k
Copy link

Take the calendar for instance, the typings file for it defines it as:

interface CalendarProps {
    id: string;
    value: any;
    defaultDate: Date;
    selectionMode: string;
    style: string;
    className: string;
    inputStyle: string;
    inputClassName: string;
    placeholder: string;
    disabled: boolean;
    dateFormat: string;
    inline: boolean;
    showOtherMonths: boolean;
    selectOtherMonths: boolean;
    showIcon: boolean;
    icon: string;
    utc: boolean;
    showOnFocus: boolean;
    appendTo: object;
    readOnlyInput: boolean;
    shortYearCutoff: string;
    minDate: any;
    maxDate: any;
    monthNavigator: boolean;
    yearNavigator: boolean;
    maxDateCount: number;
    yearRange: string;
    showTime: boolean;
    hourFormat: string;
    timeOnly: boolean;
    locale: object;
    dataType: string;
    showButtonBar: boolean;
    todayButtonClassName: boolean;
    clearButtonClassName: boolean;
    required: boolean;
    tabindex: number;
    stepHour: number;
    stepMinute: number;
    stepSecond: number;
    showSeconds: boolean;
    disabledDates: Array<any>;
    disabledDays: Array<any>;
    onFocus?(event: Event): void;
    onSelect?(e: {originalEvent: Event, value: any}): void;
    onBlur?(event: Event): void;
    onChange?(e: {originalEvent: Event, value: any}): void;
    onTodayButtonClick?(): void;
    onClearButtonClick?(event: Event): void;
    onMouseDown?(): void;
    onKeyUp?(): void;
    onKeyPress?(): void;
    onContextMenu?(): void;
}

Where as the propTypes define defaultProps for most of this properties (even if most of them are null). Unless im mistaken (i could well be as im a newbie with type script) when i use the calendar in typescript im required to put all the fields in the interface on the jsx object every time i want to use it as only a couple of the events are marked as optional and all the rest as required. This seems like a major drawback if trying to use with TypeScript?

@cagataycivici
Copy link
Member

Yes, should have been optional. Most of the components seem correct, calendar has this issue.

@cagataycivici cagataycivici self-assigned this Feb 9, 2018
@cagataycivici cagataycivici added the Type: Bug Issue contains a defect related to a specific component. label Feb 9, 2018
@cagataycivici cagataycivici added this to the 1.4.1 milestone Feb 9, 2018
@cagataycivici cagataycivici changed the title Typings - mostly all fields are required but aren't in propTypes? Calendar d.ts marks all props as required Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

2 participants