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

[InputBase] Fix the `InputBaseComponentProps` type #14082

Merged
merged 4 commits into from Jan 7, 2019

Conversation

3 participants
@franklixuefei
Copy link
Contributor

franklixuefei commented Jan 4, 2019

related to #14068

The reason for the PR is:

According to the implementation here:

/**
   * The component used for the native input.
   * Either a string to use a DOM element or a component.
   */
  inputComponent: componentPropType,

inputComponent can be a string, <input/>, <textarea/>, or any custom component that user defines, but here in InputBase.d.ts, the type is constrained to InputBaseComponentProps, which inherits from InputBaseProps, which limits to React.HTMLAttributes<HTMLDivElement>.

franklixuefei added some commits Jan 4, 2019

@franklixuefei

This comment has been minimized.

Copy link
Contributor

franklixuefei commented Jan 4, 2019

The error is related to code formatting. I'm currently out. If anyone can kindly run yarn prettier for this PR I would really appreciate it!

franklixuefei and others added some commits Jan 4, 2019

@oliviertassinari oliviertassinari changed the title [TypeScript] Fix the `InputBaseComponentProps` type [InputBase] Fix the `InputBaseComponentProps` type Jan 4, 2019

@oliviertassinari
Copy link
Member

oliviertassinari left a comment

I have added a unit test.
These changes look good to me, I'm leaving it to the TypeScript expert: cc @eps1lon and @pelotom.

@Floriferous

This comment has been minimized.

Copy link

Floriferous commented Jan 7, 2019

Is this what could be causing a new error we started seeing? It crashes our tests!

Uncaught TypeError: Function has non-object prototype 'undefined' in instanceof check
    at Function.[Symbol.hasInstance] (<anonymous>)
    at InputBase._this.handleRefInput (modules.js:46479)
    at commitAttachRef (modules.js:88056)
    at commitAllLifeCycles (modules.js:89265)
    at HTMLUnknownElement.callCallback (modules.js:71817)
    at Object.invokeGuardedCallbackDev (modules.js:71867)
    at invokeGuardedCallback (modules.js:71924)
    at commitRoot (modules.js:89456)
    at completeRoot (modules.js:90908)
    at performWorkOnRoot (modules.js:90837)

EDIT: Internal issue, nevermind!

@franklixuefei

This comment has been minimized.

Copy link
Contributor

franklixuefei commented Jan 7, 2019

@Floriferous

This comment has been minimized.

Copy link

Floriferous commented Jan 7, 2019

Nevermind, we just had some issues in our repo because of the use of HTMLInputElement, so we set it to an empty function during our tests. Wondering how to stub it properly..

@oliviertassinari oliviertassinari merged commit 7e7570f into mui-org:master Jan 7, 2019

9 checks passed

argos Everything good!
Details
ci/circleci: checkout Your tests passed on CircleCI!
Details
ci/circleci: test_browser Your tests passed on CircleCI!
Details
ci/circleci: test_build Your tests passed on CircleCI!
Details
ci/circleci: test_material-ui-x Your tests passed on CircleCI!
Details
ci/circleci: test_regressions Your tests passed on CircleCI!
Details
ci/circleci: test_unit Your tests passed on CircleCI!
Details
codecov/patch Coverage not affected when comparing f08311d...4dbc822
Details
codecov/project 100% remains the same compared to f08311d
Details
@oliviertassinari

This comment has been minimized.

Copy link
Member

oliviertassinari commented Jan 7, 2019

@franklixuefei Thank you! I have release v3.8.2 before merging the pull-request, just in case.

@franklixuefei franklixuefei deleted the franklixuefei:patch-4 branch Jan 8, 2019

@franklixuefei

This comment has been minimized.

Copy link
Contributor

franklixuefei commented Jan 8, 2019

@oliviertassinari Thanks a bunch for merging this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment