-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
[Card] Fix TypeScript not recognizing "component" prop #20093
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
Closed
Closed
Changes from 7 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
b1fa650
Fix CardHeader breaking when `titleTypographyProps` or `subheaderTypo…
rart 87e1daf
Update fix to be done at lowest level
rart e89ddfd
[Autocomplete] Simplify error for wrong getOptionLabel (#20103)
oliviertassinari 35dae27
[Select] Simplify the demos (remove ref) (#20076)
captain-yossarian e822f3a
Making component prop optional
rart da3fd22
Using generic type for optional component prop.
rart 1c7965a
[ci] Fix azure not running (#20127)
eps1lon 223cbf3
[Autocomplete] Document listbox limitation (#20101)
zatine ab228e4
[Autocomplete] Fix typo in prop description (#20086)
vince1995 eb1529f
[Security] Bump acorn from 5.7.3 to 5.7.4 (#20105)
dependabot-preview[bot] 8cf0fb7
[core] Improve the DX when iterating on components (#20128)
oliviertassinari 468474a
Bump @testing-library/dom from 6.15.0 to 7.0.3 (#20113)
dependabot-preview[bot] 5864e08
Bump sinon from 9.0.0 to 9.0.1 (#20119)
dependabot-preview[bot] 798cf28
Bump rollup-plugin-terser from 5.2.0 to 5.3.0 (#20120)
dependabot-preview[bot] b023308
[Autocomplete] Fix clearOnEscape + multiple combination (#20065)
chaudharykiran a94ad0c
Bump date-fns from 2.10.0 to 2.11.0 (#20118)
dependabot-preview[bot] 75fbb26
Bump yargs from 15.2.0 to 15.3.0 (#20114)
dependabot-preview[bot] 383175a
Bump jsdom from 16.2.0 to 16.2.1 (#20123)
dependabot-preview[bot] bd8a9b1
Bump danger from 9.2.10 to 9.3.0 (#20117)
dependabot-preview[bot] dc27bd2
Bump webpack-bundle-analyzer from 3.6.0 to 3.6.1 (#20122)
dependabot-preview[bot] f32c94e
Use generic type for optional component prop.
rart 7285bbd
Bump @types/chai from 4.2.10 to 4.2.11 (#20116)
dependabot-preview[bot] 2170e67
Use generic type for optional component prop.
rart 6fcefc4
Bump eslint-config-airbnb from 17.1.1 to 18.1.0 (#20124)
dependabot-preview[bot] f27c78f
[Autocomplete] Fix GitHub's demo behavior (#19928)
hasanozacar 93ef218
[AvatarGroup] Add max avatar prop (#19853)
GFynbo 70c937d
[styles] Fix theme default props overriden by Component defaul… (#20091)
adridavid 294760f
[docs] Display color preview in IntelliSense (#20079)
eps1lon 836b11e
[core] Batch small changes (#20111)
oliviertassinari 7c47bf6
[docs] Fix SEO issues (#20108)
oliviertassinari 1d20156
[Skeleton] Improve wave dark mode support (#20112)
oliviertassinari bbcc43d
[core] Fix deepmerge of DOM elements (#20100)
ValentinH 701e3ad
[core] Update type defs to use OverridableComponent (#20110)
16b72d7
Clean test code from unessential comments and annotations
rart eec5e1a
[docs] Simplify drawer examples (#20040)
TommyJackson85 b49804c
[Autocomplete] Make categories more obvious (#20142)
embeddedt 27d2a62
Bump @testing-library/react from 9.5.0 to 10.0.1 (#20121)
dependabot-preview[bot] 7d23542
[core] Fix docs:api cleaning the wrong directory (#20164)
ro7584 0176a23
v4.9.6
oliviertassinari db2865a
[docs] Add select prop to TextField example (#20167)
vince1995 276b8ff
[test] Restore nextjs cache for size snapshot (#20155)
eps1lon 10bc98f
[core] Patch correct dependencies
oliviertassinari 4fe9051
[ListItemText] Add comonent prop to primaryTypographyProps and… (#19155)
fyodor-e a3cc7e5
[ListItemText] Add JSDOC to typescript props (#20171)
eps1lon f1831df
[docs] Link to demos and API in IntelliSense (#20078)
eps1lon 261da95
[WIP] Add CardHeader types and tests for nested typography components…
rart 968b06b
Merge remote-tracking branch 'roy/fix-nested-typography-prop-componen…
rart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import React from 'react'; | ||
| import CardHeader from '@material-ui/core/CardHeader'; | ||
|
|
||
| declare var yada: () => void; | ||
|
|
||
| const CardHeaderTest = () => { | ||
| const FunctionComponent: React.FC<{ prop1: string; prop2: number }> = () => <div />; | ||
| function notAnElementType(): void { | ||
| yada(); | ||
| } | ||
| function SimpleFunctionComponent() { | ||
| return <div />; | ||
| } | ||
| return ( | ||
| <div> | ||
| <CardHeader /> | ||
| <CardHeader | ||
| titleTypographyProps={{ align: 'center' }} | ||
| subheaderTypographyProps={{ align: 'center' }} | ||
| /> | ||
| <CardHeader | ||
| titleTypographyProps={{ align: 'center', component: 'h1' }} | ||
| subheaderTypographyProps={{ align: 'center', component: 'p' }} | ||
| /> | ||
| <CardHeader | ||
| titleTypographyProps={{ align: 'center', component: FunctionComponent }} | ||
| subheaderTypographyProps={{ align: 'center', component: FunctionComponent }} | ||
| /> | ||
| <CardHeader | ||
| titleTypographyProps={{ align: 'center', component: SimpleFunctionComponent }} | ||
| subheaderTypographyProps={{ align: 'center', component: SimpleFunctionComponent }} | ||
| /> | ||
| // $ExpectError | ||
| <CardHeader | ||
| titleTypographyProps={{ align: 'center', component: notAnElementType }} | ||
| subheaderTypographyProps={{ align: 'center', component: notAnElementType }} | ||
| /> | ||
| // $ExpectError | ||
| <CardHeader | ||
| titleTypographyProps={{ align: 'center', component: 'my-element' }} | ||
| subheaderTypographyProps={{ align: 'center', component: 'my-element' }} | ||
| /> | ||
| </div> | ||
| ); | ||
| }; |
46 changes: 46 additions & 0 deletions
46
packages/material-ui/src/ListItemText/ListItemText.spec.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import React from 'react'; | ||
| import ListItemText from '@material-ui/core/ListItemText'; | ||
|
|
||
| declare var yada: () => void; | ||
|
|
||
| const ListItemTextTest = () => { | ||
| const FunctionComponent: React.FC<{ prop1: string; prop2: number }> = () => <div />; | ||
| function notAnElementType(): void { | ||
| yada(); | ||
| } | ||
| function SimpleFunctionComponent() { | ||
| return <div />; | ||
| } | ||
| return ( | ||
| <div> | ||
| <ListItemText /> | ||
| <ListItemText disableTypography /> | ||
| <ListItemText | ||
| primaryTypographyProps={{ align: 'center' }} | ||
| secondaryTypographyProps={{ align: 'center' }} | ||
| /> | ||
| <ListItemText | ||
| primaryTypographyProps={{ align: 'center', component: 'h1' }} | ||
| secondaryTypographyProps={{ align: 'center', component: 'p' }} | ||
| /> | ||
| <ListItemText | ||
| primaryTypographyProps={{ align: 'center', component: FunctionComponent }} | ||
| secondaryTypographyProps={{ align: 'center', component: FunctionComponent }} | ||
| /> | ||
| <ListItemText | ||
| primaryTypographyProps={{ align: 'center', component: SimpleFunctionComponent }} | ||
| secondaryTypographyProps={{ align: 'center', component: SimpleFunctionComponent }} | ||
| /> | ||
| // $ExpectError | ||
| <ListItemText | ||
| primaryTypographyProps={{ align: 'center', component: notAnElementType }} | ||
| secondaryTypographyProps={{ align: 'center', component: notAnElementType }} | ||
| /> | ||
| // $ExpectError | ||
| <ListItemText | ||
| primaryTypographyProps={{ align: 'center', component: 'my-element' }} | ||
| secondaryTypographyProps={{ align: 'center', component: 'my-element' }} | ||
| /> | ||
| </div> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.