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

TypeScript error : Type '"onFocus"' is not assignable to type in text-field-helper.d.ts #1311

Closed
yamagen0915 opened this issue Sep 12, 2019 · 2 comments · Fixed by #1315
Closed

Comments

@yamagen0915
Copy link

yamagen0915 commented Sep 12, 2019

A GIF or MEME to give some spice of the internet

Environment

Tech Version
@material-ui/pickers 3.2.5
material-ui 4.4.2
React 16.9.0
Browser
Peer library typescript 3.6.3

Steps to reproduce

  1. Upgrade material-ui/core from 4.3.3 to 4.4.2
  2. Build failed

Expected behavior

I expect build is successful

Actual behavior

I got a TypeScript error like this:

TypeScript error in /workspaces/sample/node_modules/@material-ui/pickers/_helpers/text-field-helper.d.ts(25,254):
Type '"hidden" | "color" | "style" | "open" | "disabled" | "label" | "select" | "title" | "key" | "ref" | "children" | "margin" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | ... 305 more ... | "onYearChange"' does not satisfy the constraint '"hidden" | "color" | "style" | "open" | "disabled" | "label" | "select" | "title" | "key" | "ref" | "children" | "margin" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | ... 305 more ... | "openTo"'.
  Type '"onFocus"' is not assignable to type '"hidden" | "color" | "style" | "open" | "disabled" | "label" | "select" | "title" | "key" | "ref" | "children" | "margin" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | ... 305 more ... | "openTo"'.  TS2344

    23 |     maxDateMessage?: React.ReactNode;
    24 | }
  > 25 | export declare const validate: (value: ParsableDate, utils: IUtils<any>, { maxDate, minDate, disablePast, disableFuture, maxDateMessage, minDateMessage, invalidDateMessage, strictCompareDates, }: Pick<import("../DatePicker/DatePicker").DatePickerProps, "children" | "ref" | "label" | "select" | "style" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "innerRef" | "error" | "open" | "disabled" | "name" | "margin" | "key" | "autoFocus" | "type" | "value" | "fullWidth" | "format" | "orientation" | "autoComplete" | "required" | "rows" | "onMonthChange" | "leftArrowIcon" | "rightArrowIcon" | "leftArrowButtonProps" | "rightArrowButtonProps" | "onClose" | "onAccept" | "okLabel" | "cancelLabel" | "clearLabel" | "todayLabel" | "clearable" | "showTodayButton" | "DialogProps" | "PopoverProps" | "hiddenLabel" | "InputProps" | "inputProps" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "inputRef" | "multiline" | "rowsMax" | "SelectProps" | "onOpen" | "minDate" | "maxDate" | "disableFuture" | "disablePast" | "shouldDisableDate" | "renderDay" | "allowKeyboardControl" | "loadingIndicator" | "inputVariant" | "TextFieldComponent" | "initialFocusedDate" | "autoOk" | "minDateMessage" | "maxDateMessage" | "invalidDateMessage" | "labelFunc" | "invalidLabel" | "emptyLabel" | "disableToolbar" | "ToolbarComponent" | "strictCompareDates" | "animateYearScrolling" | "onYearChange">) => import("react").ReactNode;
       |                                                                                                                                                                                                                                                              ^
    26 | export declare function pick12hOr24hFormat(userFormat: string | undefined, ampm: boolean | undefined, formats: {
    27 |     '12h': string;
    28 |     '24h': string;

"onBlur" and "onFocus" was removed from the BaseTextFieldProps by mui/material-ui#17378 .

Live example

@Jkitche
Copy link

Jkitche commented Sep 12, 2019

Can confirm this. Also seeing:

    TS2344: Type '"onChange" | "onError" | "value" | "variant"' does not satisfy the constraint '"ref" | "label" | "select" | "style" | "title" | "children" | "error" | "color" | "margin" | "hidden" | "disabled" | "fullWidth" | "multiline" | "required" | "hiddenLabel" | "className" | ... 259 more ... | "SelectProps"'.
  Type '"onChange"' is not assignable to type '"ref" | "label" | "select" | "style" | "title" | "children" | "error" | "color" | "margin" | "hidden" | "disabled" | "fullWidth" | "multiline" | "required" | "hiddenLabel" | "className" | ... 259 more ... | "SelectProps"'.

ERROR in [at-loader] ./node_modules/@material-ui/pickers/_shared/PureDateInput.d.ts:5:75 
    TS2344: Type '"onChange" | "onError" | "value" | "variant"' does not satisfy the constraint '"ref" | "label" | "select" | "style" | "title" | "children" | "error" | "color" | "margin" | "hidden" | "disabled" | "fullWidth" | "multiline" | "required" | "hiddenLabel" | "className" | ... 259 more ... | "SelectProps"'.
  Type '"onChange"' is not assignable to type '"ref" | "label" | "select" | "style" | "title" | "children" | "error" | "color" | "margin" | "hidden" | "disabled" | "fullWidth" | "multiline" | "required" | "hiddenLabel" | "className" | ... 259 more ... | "SelectProps"'.

ERROR in [at-loader] ./node_modules/@material-ui/pickers/_helpers/text-field-helper.d.ts:25:254 
    TS2344: Type '"ref" | "label" | "select" | "style" | "title" | "children" | "error" | "color" | "margin" | "hidden" | "open" | "disabled" | "fullWidth" | "multiline" | "required" | "hiddenLabel" | ... 305 more ... | "onYearChange"' does not satisfy the constraint '"ref" | "label" | "select" | "style" | "title" | "children" | "error" | "color" | "margin" | "hidden" | "open" | "disabled" | "fullWidth" | "multiline" | "required" | "hiddenLabel" | ... 305 more ... | "openTo"'.
  Type '"onFocus"' is not assignable to type '"ref" | "label" | "select" | "style" | "title" | "children" | "error" | "color" | "margin" | "hidden" | "open" | "disabled" | "fullWidth" | "multiline" | "required" | "hiddenLabel" | ... 305 more ... | "openTo"'.

On the latest Material UI and React versions.

@Calvin-LL
Copy link
Contributor

Seems to be caused by this commit (mui/material-ui@5ff69a1#diff-56acda46fee1643367971d8c2bbb0be0) where BaseTextFieldProps was changed

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