Skip to content
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
1 change: 0 additions & 1 deletion apps/E2E/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"metro-config": "^0.80.3",
"rimraf": "^5.0.1",
"ts-node": "^10.7.0",
"typescript": "^5.8.0",
"webdriverio": "catalog:"
},
"installConfig": {
Expand Down
1 change: 0 additions & 1 deletion apps/fluent-tester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
"react-native-svg-transformer": "^1.0.0",
"react-native-test-app": "^3.9.2",
"react-test-renderer": "18.2.0",
"typescript": "^5.8.0",
"webdriverio": "catalog:"
},
"jest": {
Expand Down
3 changes: 1 addition & 2 deletions apps/win32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
"metro-config": "^0.80.3",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "18.2.0",
"rimraf": "^5.0.1",
"typescript": "4.9.4"
"rimraf": "^5.0.1"
},
"jest": {
"preset": "react-native"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@fluentui/react-native",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@fluentui-react-native/composition",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@fluentui-react-native/e2e-testing",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@fluentui-react-native/framework-base",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@fluentui-react-native/link",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@fluentui-react-native/menu",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@fluentui-react-native/tester",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@fluentui-react-native/tester-win32",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@fluentui-react-native/text",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@fluentui-react-native/use-slot",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "switch repo to typescript 5.x",
"packageName": "@uifabricshared/theming-react-native",
"email": "jasonmo@microsoft.com",
"dependentChangeType": "patch"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"prettier": "^2.4.1",
"react": "18.2.0",
"react-native": "^0.74.0",
"typescript": "^4.9.4"
"typescript": "^5.8.0"
},
"workspaces": [
"apps/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/Link/src/useLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import type { LinkProps, LinkInfo } from './Link.types';

/*These callbacks are not implemented on iOS/macOS, and cause Redboxes if passed in. Limit to only windows/win32 for now*/
const isWinPlatform = Platform.OS === (('win32' as any) || 'windows');
const isWinPlatform = Platform.OS === ('win32' as any) || Platform.OS === 'windows';
const filteredProps = isWinPlatform
? {}
: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export const MenuCallout = stagedComponent((props: MenuCalloutProps) => {
},
]}
>
{context.menuHeight + tokens.minPadding >= tokens.maxHeight ||
context.menuHeight + tokens.minPadding >= mergedProps.maxHeight ? (
{context.menuHeight + tokens.minPadding >= (tokens.maxHeight as number) ||
context.menuHeight + tokens.minPadding >= (mergedProps.maxHeight as number) ? (
<AnimatedScrollView style={[context.animationStarted && context.menuSize]}>{children}</AnimatedScrollView>
) : (
<Animated.View style={[context.animationStarted && context.menuSize]}>{children}</Animated.View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react';
import { Image, Platform, Pressable, View } from 'react-native';

import type { Slots, UseSlots } from '@fluentui-react-native/framework';
import type { Slots, UseSlots, FinalRender } from '@fluentui-react-native/framework';
import { compose, mergeProps, withSlots } from '@fluentui-react-native/framework';
import { IconV1 as Icon } from '@fluentui-react-native/icon';
import { TextV1 as Text } from '@fluentui-react-native/text';
Expand Down Expand Up @@ -43,8 +43,8 @@ export const MenuItemCheckbox = compose<MenuItemCheckboxType>({
export const menuItemFinalRender = (
menuItem: MenuItemCheckboxInfo,
Slots: Slots<MenuItemCheckboxSlotProps>,
): React.FunctionComponent<MenuItemCheckboxProps> => {
return (final: MenuItemCheckboxProps, children: React.ReactNode) => {
): FinalRender<MenuItemCheckboxProps> => {
return (final: MenuItemCheckboxProps, ...children: React.ReactNode[]) => {
const { accessibilityLabel, icon, tooltip, ...mergedProps } = mergeProps(menuItem.props, final);

const checkmarkXml = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react';
import { Image, Platform, Pressable, View } from 'react-native';

import type { Slots, UseSlots } from '@fluentui-react-native/framework';
import type { Slots, UseSlots, FinalRender } from '@fluentui-react-native/framework';
import { compose, mergeProps, withSlots } from '@fluentui-react-native/framework';
import { IconV1 as Icon } from '@fluentui-react-native/icon';
import { TextV1 as Text } from '@fluentui-react-native/text';
Expand Down Expand Up @@ -39,8 +39,8 @@ export const MenuItemRadio = compose<MenuItemRadioType>({
export const menuItemRadioFinalRender = (
menuItem: MenuItemRadioInfo,
Slots: Slots<MenuItemRadioSlotProps>,
): React.FunctionComponent<MenuItemRadioProps> => {
return (final: MenuItemRadioProps, children: React.ReactNode) => {
): FinalRender<MenuItemRadioProps> => {
return (final: MenuItemRadioProps, ...children: React.ReactNode[]) => {
const { accessibilityLabel, icon, tooltip, ...mergedProps } = mergeProps(menuItem.props, final);

const checkmarkXml = `
Expand Down
12 changes: 6 additions & 6 deletions packages/components/Text/src/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ export const Text = compressible<TextProps, TextTokens>((props: TextProps, useTo
};
}

const isWinPlatform = Platform.OS === (('win32' as any) || 'windows');
const isWin32Platform = Platform.OS === ('win32' as any);
const filteredProps = {
onKeyUp: isWinPlatform ? onKeyUp : undefined,
keyUpEvents: isWinPlatform ? keyUpEvents : undefined,
onKeyUp: isWin32Platform ? onKeyUp : undefined,
keyUpEvents: isWin32Platform ? keyUpEvents : undefined,
validKeysUp: undefined,
onKeyDown: isWinPlatform ? onKeyDown : undefined,
keyDownEvents: isWinPlatform ? keyDownEvents : undefined,
onKeyDown: isWin32Platform ? onKeyDown : undefined,
keyDownEvents: isWin32Platform ? keyDownEvents : undefined,
validKeysDown: undefined,
onAccessibilityTap: isWinPlatform ? onAccTap : undefined,
onAccessibilityTap: isWin32Platform ? onAccTap : undefined,
};

// return a continuation function that allows this text to be compressed
Expand Down
3 changes: 1 addition & 2 deletions packages/deprecated/theming-react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
"react": "18.2.0",
"react-native": "^0.74.0",
"react-native-macos": "^0.74.0",
"react-native-windows": "^0.74.0",
"typescript": "4.9.4"
"react-native-windows": "^0.74.0"
},
"peerDependencies": {
"@office-iss/react-native-win32": "^0.74.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ export type LegacyDirectComponent<TProps> = React.FunctionComponent<TProps> & {
};

/**
* Legacy type name used for consistency with old rendering patterns.
* Slot function type used in the composition framework. Slot functions return React elements (not arbitrary ReactNode values)
* since they always either call staged render functions or React.createElement.
*/
export type SlotFn<TProps> = LegacyDirectComponent<TProps>;
export type SlotFn<TProps> = {
(props: TProps, ...children: React.ReactNode[]): React.ReactElement | null;
_canCompose?: boolean;
};

/**
* MULTI-STAGE RENDERING
Expand Down
4 changes: 2 additions & 2 deletions packages/framework/composition/src/composeFactory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MergeOptions } from '@fluentui-react-native/framework-base';
import { immutableMergeCore } from '@fluentui-react-native/framework-base';
import type { ComposableFunction } from '@fluentui-react-native/framework-base';
import type { ComposableFunction, FinalRender } from '@fluentui-react-native/framework-base';
import { stagedComponent } from '@fluentui-react-native/framework-base';
import type { UseSlotOptions, Slots } from '@fluentui-react-native/use-slots';
import { buildUseSlots } from '@fluentui-react-native/use-slots';
Expand All @@ -25,7 +25,7 @@ export type ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics
/**
* staged render function that takes props and a useSlots hook as an input
*/
useRender: (props: TProps, useSlots: UseStyledSlots<TProps, TSlotProps>) => React.FunctionComponent<TProps>;
useRender: (props: TProps, useSlots: UseStyledSlots<TProps, TSlotProps>) => FinalRender<TProps>;

/**
* optional statics to attach to the component
Expand Down
3 changes: 2 additions & 1 deletion packages/framework/eslint-config-rules/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"checkJs": true,
"noEmit": true
},
"include": ["eslint.config.js"]
"include": ["eslint.config.js"],
"exclude": []
}
9 changes: 5 additions & 4 deletions packages/framework/use-slot/src/useSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';

import { mergeProps } from '@fluentui-react-native/framework-base';

import type { SlotFn, NativeReactType } from '@fluentui-react-native/framework-base';
import type { SlotFn, NativeReactType, FinalRender } from '@fluentui-react-native/framework-base';
import type { ComposableFunction, StagedRender } from '@fluentui-react-native/framework-base';

/**
Expand All @@ -27,9 +27,9 @@ export function useSlot<TProps>(
component: NativeReactType | ComposableFunction<TProps>,
props: TProps,
filter?: (propName: string) => boolean,
): React.FunctionComponent<TProps> {
): SlotFn<TProps> {
// some types to make things cleaner
type ResultHolder = { result: React.FunctionComponent<TProps> | TProps };
type ResultHolder = { result: FinalRender<TProps> | TProps };
type MemoTuple = [SlotFn<TProps>, ResultHolder];

// extract the staged component function if that pattern is being used, will be undefined if it is a standard component
Expand All @@ -54,8 +54,9 @@ export function useSlot<TProps>(
}

// now if result was a function then call it directly, if not go through the standard React.createElement process
// Type assertion is safe here because result is either FinalRender<TProps> (from stagedComponent) or TProps (props object)
return typeof result === 'function'
? (result as React.FunctionComponent)(props, ...children)
? (result as FinalRender<TProps>)(props, ...children)
: React.createElement(component, props, ...children);
};
// mark the slotFn so that withSlots knows to handle it differently
Expand Down
3 changes: 1 addition & 2 deletions packages/libraries/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"noEmitOnError": true,
"skipLibCheck": true,
"noUnusedLocals": true,
"strict": true,
"suppressImplicitAnyIndexErrors": true
"strict": true
},
"include": ["src"]
}
9 changes: 9 additions & 0 deletions scripts/src/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ function getBuildTargets(cwd = process.cwd()) {
async function buildTarget(target, cwd) {
const { module, outDir } = target;
const extraArgs = ['--outDir', outDir, '--module', module];

// TypeScript 5.8+ requires moduleResolution to match module when using Node16
// Set moduleResolution to match the module setting
if (module === 'node16') {
extraArgs.push('--moduleResolution', 'node16');
} else if (module === 'esnext') {
extraArgs.push('--moduleResolution', 'bundler');
}

const result = await runScript('tsc', ...extraArgs);

if (result !== 0) {
Expand Down
2 changes: 1 addition & 1 deletion tester_deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@wdio/spec-reporter": "^9.12.6",
"appium": "^2.11.2",
"appium-windows-driver": "^2.12.18",
"typescript": "^4.9.4",
"typescript": "^5.8.0",
"webdriverio": "^9.12.6"
},
"resolutions": {
Expand Down
Loading
Loading