Skip to content

Commit

Permalink
[docs] Put in null as a type of value in onChange in Rating component
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Chan committed Jun 1, 2021
1 parent 363bbbf commit 04e696c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/scripts/buildApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ function resolveType(type: NonNullable<doctrine.Tag['type']>): string {
return 'void';
}

if (type.type === 'NullLiteral') {
return 'null';
}

if (type.type === 'TypeApplication') {
const arrayTypeName = resolveType(type.applications[0]);
return `${arrayTypeName}[]`;
Expand Down
2 changes: 1 addition & 1 deletion docs/translations/api-docs/rating/rating.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"IconContainerComponent": "The component containing the icon.",
"max": "Maximum rating.",
"name": "The name attribute of the radio <code>input</code> elements. This input <code>name</code> should be unique within the page. Being unique within a form is insufficient since the <code>name</code> is used to generated IDs.",
"onChange": "Callback fired when the value changes.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>value:</em> The new value.",
"onChange": "Callback fired when the value changes.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number \\| null) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>value:</em> The new value.",
"onChangeActive": "Callback function that is fired when the hover state changes.<br><br><strong>Signature:</strong><br><code>function(event: object, value: number) =&gt; void</code><br><em>event:</em> The event source of the callback.<br><em>value:</em> The new value.",
"precision": "The minimum increment value change allowed.",
"readOnly": "Removes all hover effects and pointer events.",
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Rating/Rating.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface RatingProps
/**
* Callback fired when the value changes.
* @param {object} event The event source of the callback.
* @param {number} value The new value.
* @param {number|null} value The new value.
*/
onChange?: (event: React.SyntheticEvent, value: number | null) => void;
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Rating/Rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ Rating.propTypes /* remove-proptypes */ = {
/**
* Callback fired when the value changes.
* @param {object} event The event source of the callback.
* @param {number} value The new value.
* @param {number|null} value The new value.
*/
onChange: PropTypes.func,
/**
Expand Down

0 comments on commit 04e696c

Please sign in to comment.