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

chore: migrate to TS 4.7 #28067

Merged
merged 16 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: bump api-extractor-model to support typescript 4.7",
"packageName": "@fluentui/api-docs",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: migrate to ts 4.7 which wont emit undefined anymore for optional arguments",
"packageName": "@fluentui/date-time-utilities",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: migrate to ts 4.7 which wont emit undefined anymore for optional arguments",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: resolve FloatingSuggestion if conditions to mitigate ts 4.7 always true violation\"",
"packageName": "@fluentui/react-experiments",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: migrate to ts 4.7 which wont emit undefined anymore for optional arguments",
"packageName": "@fluentui/react-migration-v8-v9",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: migrate to ts 4.7 which wont emit undefined anymore for optional arguments",
"packageName": "@fluentui/react-positioning",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "chore: re-generate api.md",
"packageName": "@fluentui/react-shared-contexts",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: migrate to ts 4.7 which wont emit undefined anymore for optional arguments",
"packageName": "@fluentui/react-tabster",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "chore: migrate to ts 4.7 which wont emit undefined anymore for optional arguments",
"packageName": "@fluentui/react-virtualizer",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "fix: cast to String keys interpolated within string literals",
"packageName": "@fluentui/tokens",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: cast to String keys interpolated within string literals",
"packageName": "@fluentui/utilities",
"email": "[email protected]",
"dependentChangeType": "patch"
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@
"@griffel/webpack-loader": "2.1.13",
"@jest/reporters": "29.5.0",
"@mdx-js/loader": "1.6.22",
"@microsoft/api-extractor": "7.28.7",
"@microsoft/api-extractor-model": "7.22.2",
"@microsoft/tsdoc": "0.14.2",
"@microsoft/api-extractor": "7.31.2",
"@microsoft/api-extractor-model": "7.24.2",
"@microsoft/tsdoc": "0.14.1",
"@microsoft/eslint-plugin-sdl": "0.1.9",
"@microsoft/load-themed-styles": "1.10.26",
"@microsoft/loader-load-themed-styles": "2.0.17",
Expand Down Expand Up @@ -344,7 +344,7 @@
"tsconfig-paths": "4.1.0",
"tsconfig-paths-webpack-plugin": "4.0.0",
"tslib": "2.4.1",
"typescript": "4.6.4",
"typescript": "4.7.4",
"vinyl": "2.2.0",
"vrscreenshotdiff": "0.0.17",
"webpack": "5.83.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@fluentui/scripts-tasks": "*"
},
"dependencies": {
"@microsoft/api-extractor-model": "7.17.1",
"@microsoft/api-extractor-model": "7.24.2",
"@microsoft/tsdoc": "0.14.1",
"fs-extra": "^8.1.0"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/date-time-utilities/etc/date-time-utilities.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ export const formatMonthDayYear: (date: Date, strings: IDateGridStrings) => stri
export const formatMonthYear: (date: Date, strings: IDateGridStrings) => string;

// @public
export const formatTimeString: (date: Date, showSeconds?: boolean | undefined, useHour12?: boolean | undefined) => string;
export const formatTimeString: (date: Date, showSeconds?: boolean, useHour12?: boolean) => string;

// @public
export const formatYear: (date: Date) => string;

// @public
export const getBoundedDateRange: (dateRange: Date[], minDate?: Date | undefined, maxDate?: Date | undefined) => Date[];
export const getBoundedDateRange: (dateRange: Date[], minDate?: Date, maxDate?: Date) => Date[];

// @public
export const getDateFromTimeSelection: (useHour12: boolean, dateStartAnchor: Date, selectedTime: string) => Date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const Portal: React.FC<PortalProps> & FluentComponentStaticProps<PortalPr

const renderPortal = (): JSX.Element | undefined => {
const contentToRender = childrenExist(children) ? children : content;
const focusTrapZoneProps = (_.keys(trapFocus).length && trapFocus) || {};
const focusTrapZoneProps = typeof trapFocus === 'boolean' ? {} : trapFocus;
return (
open && (
<Ref innerRef={portalRef}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ export const renderBreadcrumbItem_unstable: (state: BreadcrumbItemState) => JSX.
export const renderBreadcrumbLink_unstable: (state: BreadcrumbLinkState) => JSX.Element;

// @public (undocumented)
export const truncateBreadcrumbLongName: (content: string, maxLength?: number | undefined) => string;
export const truncateBreadcrumbLongName: (content: string, maxLength?: number) => string;

// @public (undocumented)
export const truncateBreadcrumLongTooltip: (content: string, maxLength?: number | undefined) => string;
export const truncateBreadcrumLongTooltip: (content: string, maxLength?: number) => string;

// @public
export const useBreadcrumb_unstable: (props: BreadcrumbProps, ref: React_2.Ref<HTMLElement>) => BreadcrumbState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ export const CompoundButtonShim: React_2.ForwardRefExoticComponent<IButtonProps
export const createBrandVariants: (palette: IPalette, interpolation?: Interpolation) => BrandVariants;

// @public
export const createV8Theme: (brandColors: BrandVariants, themeV9: Theme, isDarkTheme?: boolean, themeV8?: Theme_2 | undefined) => Theme_2;
export const createV8Theme: (brandColors: BrandVariants, themeV9: Theme, isDarkTheme?: boolean, themeV8?: Theme_2) => Theme_2;

// @public
export const createV9Theme: (themeV8: Theme_2, baseThemeV9?: Theme | undefined) => Theme;
export const createV9Theme: (themeV8: Theme_2, baseThemeV9?: Theme) => Theme;

// @public
export const DefaultButtonShim: React_2.ForwardRefExoticComponent<IButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export type SetVirtualMouseTarget = (event: React_2.MouseEvent | MouseEvent | un
export function usePositioning(options: UsePositioningOptions): UsePositioningReturn;

// @internal
export const usePositioningMouseTarget: (initialState?: PositioningVirtualElement | (() => PositioningVirtualElement) | undefined) => readonly [PositioningVirtualElement | undefined, SetVirtualMouseTarget];
export const usePositioningMouseTarget: (initialState?: PositioningVirtualElement | (() => PositioningVirtualElement)) => readonly [PositioningVirtualElement | undefined, SetVirtualMouseTarget];

// (No @packageDocumentation comment for this package)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export const useCustomStyleHook_unstable: (hook: keyof CustomStyleHooksContextVa
// @public (undocumented)
export function useFluent_unstable(): ProviderContextValue_unstable;

// Warning: (ae-incompatible-release-tags) The symbol "useOverrides" is marked as @public, but its signature references "OverridesContextValue" which is marked as @internal
// Warning: (ae-incompatible-release-tags) The symbol "useOverrides" is marked as @public, but its signature references "OverridesContextValue_unstable" which is marked as @internal
//
// @public (undocumented)
export function useOverrides_unstable(): OverridesContextValue_unstable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface UseArrowNavigationGroupOptions {
}

// @public
export const useFocusableGroup: (options?: UseFocusableGroupOptions | undefined) => Types.TabsterDOMAttribute;
export const useFocusableGroup: (options?: UseFocusableGroupOptions) => Types.TabsterDOMAttribute;

// @public (undocumented)
export interface UseFocusableGroupOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const useToastBodyStyles_unstable: (state: ToastBodyState) => ToastBodySt

// @public (undocumented)
export function useToastController(toasterId?: ToasterId): {
dispatchToast: (content: React_2.ReactNode, options?: DispatchToastOptions | undefined) => void;
dispatchToast: (content: React_2.ReactNode, options?: DispatchToastOptions) => void;
dismissToast: (toastId: ToastId) => void;
dismissAllToasts: () => void;
updateToast: (options: UpdateToastOptions) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const useDynamicVirtualizerMeasure: <TElement extends HTMLElement>(virtua
};

// @public
export const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit | undefined) => {
export const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit) => {
setObserverList: Dispatch<SetStateAction<Element[] | undefined>>;
setObserverInit: Dispatch<SetStateAction<IntersectionObserverInit | undefined>>;
observer: MutableRefObject<IntersectionObserver | undefined>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class FloatingSuggestions<TItem>
public onQueryStringChanged = (queryString: string): void => {
if (queryString !== this.state.queryString) {
this.setState({
queryString: queryString,
queryString,
});

if (this.props.onInputChanged) {
Expand Down Expand Up @@ -278,9 +278,8 @@ export class FloatingSuggestions<TItem>
case KeyCodes.del:
if (
this.props.onRemoveSuggestion &&
this.suggestionsControl.current &&
this.suggestionsControl.current.hasSuggestionSelected &&
this.suggestionsControl.current.currentSuggestion &&
this.suggestionsControl.current?.hasSuggestionSelected &&
this.suggestionsControl.current?.currentSuggestion &&
ev.shiftKey
) {
this.props.onRemoveSuggestion(this.suggestionsControl.current.currentSuggestion!.item);
Expand Down
32 changes: 16 additions & 16 deletions packages/react/etc/react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ export class BaseExtendedPicker<T, P extends IBaseExtendedPickerProps<T>> extend
// (undocumented)
protected onCopy: (ev: React_2.ClipboardEvent<HTMLElement>) => void;
// (undocumented)
protected onInputChange: (value: string, composing?: boolean | undefined) => void;
protected onInputChange: (value: string, composing?: boolean) => void;
// (undocumented)
protected onInputClick: (ev: React_2.MouseEvent<HTMLInputElement | Autofill>) => void;
// (undocumented)
Expand Down Expand Up @@ -1068,7 +1068,7 @@ export const CompactPeoplePicker: React_2.FunctionComponent<IPeoplePickerProps>;
export class CompactPeoplePickerBase extends BasePeoplePicker {
static defaultProps: {
onRenderItem: (props: IPeoplePickerItemSelectedProps) => JSX.Element;
onRenderSuggestionsItem: (personaProps: IPersonaProps, suggestionsProps?: IBasePickerSuggestionsProps<any> | undefined) => JSX.Element;
onRenderSuggestionsItem: (personaProps: IPersonaProps, suggestionsProps?: IBasePickerSuggestionsProps) => JSX.Element;
createGenericItem: typeof createGenericItem;
};
}
Expand Down Expand Up @@ -1117,7 +1117,7 @@ export const ContextualMenuItem: React_2.FunctionComponent<IContextualMenuItemPr
export class ContextualMenuItemBase extends React_2.Component<IContextualMenuItemProps, {}> {
constructor(props: IContextualMenuItemProps);
// (undocumented)
dismissMenu: (dismissAll?: boolean | undefined) => void;
dismissMenu: (dismissAll?: boolean) => void;
// (undocumented)
dismissSubMenu: () => void;
// (undocumented)
Expand Down Expand Up @@ -1322,7 +1322,7 @@ export class DetailsListBase extends React_2.Component<IDetailsListProps, IDetai
// (undocumented)
getStartItemIndexInView(): number;
// (undocumented)
protected _onRenderRow: (props: IDetailsRowProps, defaultRender?: IRenderFunction<IDetailsRowProps> | undefined) => JSX.Element;
protected _onRenderRow: (props: IDetailsRowProps, defaultRender?: IRenderFunction<IDetailsRowProps>) => JSX.Element;
// (undocumented)
render(): JSX.Element;
// (undocumented)
Expand Down Expand Up @@ -1712,7 +1712,7 @@ export { formProperties }
export const getActivityItemClassNames: (styles: IActivityItemStyles, className: string, activityPersonas: Array<IPersonaProps>, isCompact: boolean) => IActivityItemClassNames;

// @public (undocumented)
export const getActivityItemStyles: (theme?: ITheme, customStyles?: IActivityItemStyles | undefined, animateBeaconSignal?: IActivityItemProps['animateBeaconSignal'], beaconColorOne?: IActivityItemProps['beaconColorOne'], beaconColorTwo?: IActivityItemProps['beaconColorTwo'], isCompact?: IActivityItemProps['isCompact']) => IActivityItemStyles;
export const getActivityItemStyles: (theme?: ITheme, customStyles?: IActivityItemStyles, animateBeaconSignal?: IActivityItemProps['animateBeaconSignal'], beaconColorOne?: IActivityItemProps['beaconColorOne'], beaconColorTwo?: IActivityItemProps['beaconColorTwo'], isCompact?: IActivityItemProps['isCompact']) => IActivityItemStyles;

// @public (undocumented)
export function getAllSelectedOptions(options: ISelectableOption[], selectedIndices: number[]): ISelectableOption[];
Expand Down Expand Up @@ -1755,7 +1755,7 @@ export const getCommandButtonStyles: (customStyles: IButtonStyles | undefined) =
// Warning: (ae-internal-missing-underscore) The name "getContextualMenuItemClassNames" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal @deprecated (undocumented)
export const getContextualMenuItemClassNames: (theme: ITheme, disabled: boolean, expanded: boolean, checked: boolean, isAnchorLink: boolean, knownIcon: boolean, itemClassName?: string | undefined, dividerClassName?: string | undefined, iconClassName?: string | undefined, subMenuClassName?: string | undefined, primaryDisabled?: boolean | undefined, className?: string | undefined) => IContextualMenuItemStyles;
export const getContextualMenuItemClassNames: (theme: ITheme, disabled: boolean, expanded: boolean, checked: boolean, isAnchorLink: boolean, knownIcon: boolean, itemClassName?: string, dividerClassName?: string, iconClassName?: string, subMenuClassName?: string, primaryDisabled?: boolean, className?: string) => IContextualMenuItemStyles;

// @public
export const getContextualMenuItemStyles: (props: IContextualMenuItemStyleProps) => IContextualMenuItemStyles;
Expand Down Expand Up @@ -1807,7 +1807,7 @@ export { getFocusOutlineStyle }
export { getFocusStyle }

// @public
export const getFontIcon: (iconName: string, className?: string | undefined, ariaLabel?: string | undefined) => React_2.ReactElement<any, any> | null;
export const getFontIcon: (iconName: string, className?: string, ariaLabel?: string) => React_2.ReactElement<any, any> | null;

// @public
export function getFullColorString(color: IColor): string;
Expand All @@ -1824,7 +1824,7 @@ export { getIcon }
export { getIconClassName }

// @public (undocumented)
export const getIconContent: (iconName?: string | undefined) => IIconContent | null;
export const getIconContent: (iconName?: string) => IIconContent | null;

export { getId }

Expand Down Expand Up @@ -1880,7 +1880,7 @@ export const getNextResizeGroupStateProvider: (measurementCache?: {
getCachedMeasurement: (data: any) => number | undefined;
addMeasurementToCache: (data: any, measurement: number) => void;
}) => {
getNextState: (props: IResizeGroupProps, currentState: IResizeGroupState, getElementToMeasureDimension: () => number, newContainerDimension?: number | undefined) => IResizeGroupState | undefined;
getNextState: (props: IResizeGroupProps, currentState: IResizeGroupState, getElementToMeasureDimension: () => number, newContainerDimension?: number) => IResizeGroupState | undefined;
shouldRenderDataForMeasurement: (dataToMeasure: any | undefined) => boolean;
getInitialResizeGroupState: (data: any) => IResizeGroupState;
};
Expand Down Expand Up @@ -1927,7 +1927,7 @@ export function getShade(color: IColor, shade: Shade, isInverted?: boolean): ICo
export const getShimmeredDetailsListStyles: (props: IShimmeredDetailsListStyleProps) => IShimmeredDetailsListStyles;

// @public (undocumented)
export const getSplitButtonClassNames: (styles: IButtonStyles, disabled: boolean, expanded: boolean, checked: boolean, primaryDisabled?: boolean | undefined) => ISplitButtonClassNames;
export const getSplitButtonClassNames: (styles: IButtonStyles, disabled: boolean, expanded: boolean, checked: boolean, primaryDisabled?: boolean) => ISplitButtonClassNames;

export { getStartDateOfWeek }

Expand Down Expand Up @@ -2079,7 +2079,7 @@ export class HoverCardBase extends React_2.Component<IHoverCardProps, IHoverCard
type: HoverCardType;
};
// (undocumented)
dismiss: (withTimeOut?: boolean | undefined) => void;
dismiss: (withTimeOut?: boolean) => void;
// (undocumented)
render(): JSX.Element;
}
Expand Down Expand Up @@ -9860,7 +9860,7 @@ export const ListPeoplePicker: React_2.FunctionComponent<IPeoplePickerProps>;
export class ListPeoplePickerBase extends MemberListPeoplePicker {
static defaultProps: {
onRenderItem: (props: IPeoplePickerItemSelectedProps) => JSX.Element;
onRenderSuggestionsItem: (personaProps: IPersonaProps, suggestionsProps?: IBasePickerSuggestionsProps<any> | undefined) => JSX.Element;
onRenderSuggestionsItem: (personaProps: IPersonaProps, suggestionsProps?: IBasePickerSuggestionsProps) => JSX.Element;
createGenericItem: typeof createGenericItem;
};
}
Expand Down Expand Up @@ -10012,7 +10012,7 @@ export const NormalPeoplePicker: React_2.FunctionComponent<IPeoplePickerProps>;
export class NormalPeoplePickerBase extends BasePeoplePicker {
static defaultProps: {
onRenderItem: (props: IPeoplePickerItemSelectedProps) => JSX.Element;
onRenderSuggestionsItem: (personaProps: IPersonaProps, suggestionsProps?: IBasePickerSuggestionsProps<any> | undefined) => JSX.Element;
onRenderSuggestionsItem: (personaProps: IPersonaProps, suggestionsProps?: IBasePickerSuggestionsProps) => JSX.Element;
createGenericItem: typeof createGenericItem;
};
}
Expand Down Expand Up @@ -10087,7 +10087,7 @@ export class PanelBase extends React_2.Component<IPanelProps, IPanelState> imple
// (undocumented)
static defaultProps: IPanelProps;
// (undocumented)
dismiss: (ev?: KeyboardEvent | React_2.SyntheticEvent<HTMLElement, Event> | undefined) => void;
dismiss: (ev?: React_2.SyntheticEvent<HTMLElement> | KeyboardEvent) => void;
// (undocumented)
static getDerivedStateFromProps(nextProps: Readonly<IPanelProps>, prevState: Readonly<IPanelState>): Partial<IPanelState> | null;
get isActive(): boolean;
Expand Down Expand Up @@ -10551,7 +10551,7 @@ export class ScrollablePaneBase extends React_2.Component<IScrollablePaneProps,
// (undocumented)
shouldComponentUpdate(nextProps: IScrollablePaneProps, nextState: IScrollablePaneState): boolean;
// (undocumented)
sortSticky: (sticky: Sticky, sortAgain?: boolean | undefined) => void;
sortSticky: (sticky: Sticky, sortAgain?: boolean) => void;
// (undocumented)
get stickyAbove(): HTMLDivElement | null;
// (undocumented)
Expand Down Expand Up @@ -11364,7 +11364,7 @@ export function useHeightOffset({ finalHeight }: IPositioningContainerProps, con
export function useKeytipRef<TElement extends HTMLElement = HTMLElement>(options: KeytipDataOptions): React_2.Ref<TElement>;

// @public
export const useResponsiveMode: (elementRef: React_2.RefObject<HTMLElement | null>, overrideResponsiveMode?: ResponsiveMode | undefined) => ResponsiveMode;
export const useResponsiveMode: (elementRef: React_2.RefObject<HTMLElement | null>, overrideResponsiveMode?: ResponsiveMode) => ResponsiveMode;

// @public @deprecated
export type UseStylesOptions = {
Expand Down
Loading