Skip to content

Commit

Permalink
[typescript][base] Rename one letter type parameters (#38171)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak authored Jul 27, 2023
1 parent 418f239 commit 495d3f7
Show file tree
Hide file tree
Showing 15 changed files with 143 additions and 130 deletions.
52 changes: 29 additions & 23 deletions docs/pages/base-ui/api/use-autocomplete.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"parameters": {
"options": {
"type": { "name": "ReadonlyArray<T>", "description": "ReadonlyArray<T>" },
"type": { "name": "ReadonlyArray<Value>", "description": "ReadonlyArray<Value>" },
"required": true
},
"autoComplete": { "type": { "name": "boolean", "description": "boolean" }, "default": "false" },
Expand All @@ -28,8 +28,8 @@
"componentName": { "type": { "name": "string", "description": "string" } },
"defaultValue": {
"type": {
"name": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>",
"description": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>"
"name": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>",
"description": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>"
},
"default": "props.multiple ? [] : null"
},
Expand All @@ -52,8 +52,8 @@
},
"filterOptions": {
"type": {
"name": "(options: T[], state: FilterOptionsState<T>) => T[]",
"description": "(options: T[], state: FilterOptionsState<T>) => T[]"
"name": "(options: Value[], state: FilterOptionsState<Value>) => Value[]",
"description": "(options: Value[], state: FilterOptionsState<Value>) => Value[]"
},
"default": "createFilterOptions()"
},
Expand All @@ -63,17 +63,23 @@
},
"freeSolo": { "type": { "name": "FreeSolo", "description": "FreeSolo" }, "default": "false" },
"getOptionDisabled": {
"type": { "name": "(option: T) => boolean", "description": "(option: T) => boolean" }
"type": {
"name": "(option: Value) => boolean",
"description": "(option: Value) => boolean"
}
},
"getOptionLabel": {
"type": {
"name": "(option: T | AutocompleteFreeSoloValueMapping<FreeSolo>) => string",
"description": "(option: T | AutocompleteFreeSoloValueMapping<FreeSolo>) => string"
"name": "(option: Value | AutocompleteFreeSoloValueMapping<FreeSolo>) => string",
"description": "(option: Value | AutocompleteFreeSoloValueMapping<FreeSolo>) => string"
},
"default": "(option) => option.label ?? option"
},
"groupBy": {
"type": { "name": "(option: T) => string", "description": "(option: T) => string" }
"type": {
"name": "(option: Value) => string",
"description": "(option: Value) => string"
}
},
"handleHomeEndKeys": {
"type": { "name": "boolean", "description": "boolean" },
Expand All @@ -87,15 +93,15 @@
"inputValue": { "type": { "name": "string", "description": "string" } },
"isOptionEqualToValue": {
"type": {
"name": "(option: T, value: T) => boolean",
"description": "(option: T, value: T) => boolean"
"name": "(option: Value, value: Value) => boolean",
"description": "(option: Value, value: Value) => boolean"
}
},
"multiple": { "type": { "name": "Multiple", "description": "Multiple" }, "default": "false" },
"onChange": {
"type": {
"name": "(event: React.SyntheticEvent, value: AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<T>) => void",
"description": "(event: React.SyntheticEvent, value: AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<T>) => void"
"name": "(event: React.SyntheticEvent, value: AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<Value>) => void",
"description": "(event: React.SyntheticEvent, value: AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<Value>) => void"
}
},
"onClose": {
Expand All @@ -106,8 +112,8 @@
},
"onHighlightChange": {
"type": {
"name": "(event: React.SyntheticEvent, option: T | null, reason: AutocompleteHighlightChangeReason) => void",
"description": "(event: React.SyntheticEvent, option: T | null, reason: AutocompleteHighlightChangeReason) => void"
"name": "(event: React.SyntheticEvent, option: Value | null, reason: AutocompleteHighlightChangeReason) => void",
"description": "(event: React.SyntheticEvent, option: Value | null, reason: AutocompleteHighlightChangeReason) => void"
}
},
"onInputChange": {
Expand Down Expand Up @@ -141,8 +147,8 @@
},
"value": {
"type": {
"name": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>",
"description": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>"
"name": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>",
"description": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>"
}
}
},
Expand Down Expand Up @@ -185,8 +191,8 @@
},
"getOptionProps": {
"type": {
"name": "(renderedOption: UseAutocompleteRenderedOption<T>) => React.HTMLAttributes<HTMLLIElement>",
"description": "(renderedOption: UseAutocompleteRenderedOption<T>) => React.HTMLAttributes<HTMLLIElement>"
"name": "(renderedOption: UseAutocompleteRenderedOption<Value>) => React.HTMLAttributes<HTMLLIElement>",
"description": "(renderedOption: UseAutocompleteRenderedOption<Value>) => React.HTMLAttributes<HTMLLIElement>"
},
"required": true
},
Expand All @@ -210,8 +216,8 @@
},
"groupedOptions": {
"type": {
"name": "T[] | Array<AutocompleteGroupedOption<T>>",
"description": "T[] | Array<AutocompleteGroupedOption<T>>"
"name": "Value[] | Array<AutocompleteGroupedOption<Value>>",
"description": "Value[] | Array<AutocompleteGroupedOption<Value>>"
},
"required": true
},
Expand All @@ -224,8 +230,8 @@
},
"value": {
"type": {
"name": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>",
"description": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>"
"name": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>",
"description": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>"
},
"required": true
}
Expand Down
14 changes: 7 additions & 7 deletions docs/pages/joy-ui/api/autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"type": { "name": "func" },
"default": "createFilterOptions()",
"signature": {
"type": "function(options: Array<T>, state: object) => Array<T>",
"type": "function(options: Array<Value>, state: object) => Array<Value>",
"describedArgs": ["options", "state"]
}
},
Expand All @@ -47,23 +47,23 @@
},
"getOptionDisabled": {
"type": { "name": "func" },
"signature": { "type": "function(option: T) => boolean", "describedArgs": ["option"] }
"signature": { "type": "function(option: Value) => boolean", "describedArgs": ["option"] }
},
"getOptionLabel": {
"type": { "name": "func" },
"default": "(option) => option.label ?? option",
"signature": { "type": "function(option: T) => string", "describedArgs": [] }
"signature": { "type": "function(option: Value) => string", "describedArgs": [] }
},
"groupBy": {
"type": { "name": "func" },
"signature": { "type": "function(options: T) => string", "describedArgs": ["options"] }
"signature": { "type": "function(options: Value) => string", "describedArgs": ["options"] }
},
"id": { "type": { "name": "string" } },
"inputValue": { "type": { "name": "string" } },
"isOptionEqualToValue": {
"type": { "name": "func" },
"signature": {
"type": "function(option: T, value: T) => boolean",
"type": "function(option: Value, value: Value) => boolean",
"describedArgs": ["option", "value"]
}
},
Expand All @@ -76,7 +76,7 @@
"onChange": {
"type": { "name": "func" },
"signature": {
"type": "function(event: React.SyntheticEvent, value: T | Array<T>, reason: string, details?: string) => void",
"type": "function(event: React.SyntheticEvent, value: Value | Array<Value>, reason: string, details?: string) => void",
"describedArgs": ["event", "value", "reason"]
}
},
Expand All @@ -90,7 +90,7 @@
"onHighlightChange": {
"type": { "name": "func" },
"signature": {
"type": "function(event: React.SyntheticEvent, option: T, reason: string) => void",
"type": "function(event: React.SyntheticEvent, option: Value, reason: string) => void",
"describedArgs": ["event", "option", "reason"]
}
},
Expand Down
14 changes: 7 additions & 7 deletions docs/pages/material-ui/api/autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"type": { "name": "func" },
"default": "createFilterOptions()",
"signature": {
"type": "function(options: Array<T>, state: object) => Array<T>",
"type": "function(options: Array<Value>, state: object) => Array<Value>",
"describedArgs": ["options", "state"]
}
},
Expand All @@ -62,16 +62,16 @@
},
"getOptionDisabled": {
"type": { "name": "func" },
"signature": { "type": "function(option: T) => boolean", "describedArgs": ["option"] }
"signature": { "type": "function(option: Value) => boolean", "describedArgs": ["option"] }
},
"getOptionLabel": {
"type": { "name": "func" },
"default": "(option) => option.label ?? option",
"signature": { "type": "function(option: T) => string", "describedArgs": [] }
"signature": { "type": "function(option: Value) => string", "describedArgs": [] }
},
"groupBy": {
"type": { "name": "func" },
"signature": { "type": "function(options: T) => string", "describedArgs": ["options"] }
"signature": { "type": "function(options: Value) => string", "describedArgs": ["options"] }
},
"handleHomeEndKeys": { "type": { "name": "bool" }, "default": "!props.freeSolo" },
"id": { "type": { "name": "string" } },
Expand All @@ -80,7 +80,7 @@
"isOptionEqualToValue": {
"type": { "name": "func" },
"signature": {
"type": "function(option: T, value: T) => boolean",
"type": "function(option: Value, value: Value) => boolean",
"describedArgs": ["option", "value"]
}
},
Expand All @@ -94,7 +94,7 @@
"onChange": {
"type": { "name": "func" },
"signature": {
"type": "function(event: React.SyntheticEvent, value: T | Array<T>, reason: string, details?: string) => void",
"type": "function(event: React.SyntheticEvent, value: Value | Array<Value>, reason: string, details?: string) => void",
"describedArgs": ["event", "value", "reason"]
}
},
Expand All @@ -108,7 +108,7 @@
"onHighlightChange": {
"type": { "name": "func" },
"signature": {
"type": "function(event: React.SyntheticEvent, option: T, reason: string) => void",
"type": "function(event: React.SyntheticEvent, option: Value, reason: string) => void",
"describedArgs": ["event", "option", "reason"]
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"getRootProps": { "description": "Resolver for the root slot&#39;s props." },
"getTagProps": { "description": "A tag props getter." },
"groupedOptions": {
"description": "The options to render. It&#39;s either <code>T[]</code> or <code>AutocompleteGroupedOption&lt;T&gt;[]</code> if the groupBy prop is provided."
"description": "The options to render. It&#39;s either <code>Value[]</code> or <code>AutocompleteGroupedOption&lt;Value&gt;[]</code> if the groupBy prop is provided."
},
"id": { "description": "Id for the Autocomplete." },
"inputValue": { "description": "The input value." },
Expand Down
10 changes: 6 additions & 4 deletions packages/mui-base/src/Badge/Badge.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ export interface BadgeTypeMap<
/**
* Utility to create component types that inherit props from Badge.
*/
export interface ExtendBadgeTypeMap<M extends OverridableTypeMap> {
props: M['props'] & BadgeTypeMap['props'];
defaultComponent: M['defaultComponent'];
export interface ExtendBadgeTypeMap<TypeMap extends OverridableTypeMap> {
props: TypeMap['props'] & BadgeTypeMap['props'];
defaultComponent: TypeMap['defaultComponent'];
}

export type ExtendBadge<M extends OverridableTypeMap> = OverridableComponent<ExtendBadgeTypeMap<M>>;
export type ExtendBadge<TypeMap extends OverridableTypeMap> = OverridableComponent<
ExtendBadgeTypeMap<TypeMap>
>;

export type BadgeProps<
RootComponentType extends React.ElementType = BadgeTypeMap['defaultComponent'],
Expand Down
10 changes: 6 additions & 4 deletions packages/mui-base/src/Modal/Modal.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,14 @@ export interface ModalTypeMap<
/**
* Utility to create component types that inherit props from Modal.
*/
export interface ExtendModalTypeMap<M extends OverridableTypeMap> {
props: M['props'] & ModalTypeMap['props'];
defaultComponent: M['defaultComponent'];
export interface ExtendModalTypeMap<TypeMap extends OverridableTypeMap> {
props: TypeMap['props'] & ModalTypeMap['props'];
defaultComponent: TypeMap['defaultComponent'];
}

export type ExtendModal<M extends OverridableTypeMap> = OverridableComponent<ExtendModalTypeMap<M>>;
export type ExtendModal<TypeMap extends OverridableTypeMap> = OverridableComponent<
ExtendModalTypeMap<TypeMap>
>;

export type ModalProps<
RootComponentType extends React.ElementType = ModalTypeMap['defaultComponent'],
Expand Down
10 changes: 5 additions & 5 deletions packages/mui-base/src/Slider/Slider.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ export interface SliderTypeMap<
/**
* Utility to create component types that inherit props from Slider.
*/
export interface ExtendSliderTypeMap<M extends OverridableTypeMap> {
props: M['props'] & Omit<SliderTypeMap['props'], 'isRtl'>;
defaultComponent: M['defaultComponent'];
export interface ExtendSliderTypeMap<TypeMap extends OverridableTypeMap> {
props: TypeMap['props'] & Omit<SliderTypeMap['props'], 'isRtl'>;
defaultComponent: TypeMap['defaultComponent'];
}

export type ExtendSlider<M extends OverridableTypeMap> = OverridableComponent<
ExtendSliderTypeMap<M>
export type ExtendSlider<TypeMap extends OverridableTypeMap> = OverridableComponent<
ExtendSliderTypeMap<TypeMap>
>;

export type SliderProps<
Expand Down
Loading

0 comments on commit 495d3f7

Please sign in to comment.