Skip to content

Conversation

@Hotell
Copy link
Contributor

@Hotell Hotell commented Apr 26, 2022

Current Behavior

Slot is non trivial mapped type without any testing coverage

New Behavior

Slot has some type check tests coverage

Related Issue(s)

This also exposes issue found in #22633

const noChildrenEl: ChildrenLessIntrinsicElement = { children: React.createElement('div', 'hello') };

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - FIX THE API / this doesn't work ATM and should be fixed
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hotell
Copy link
Contributor Author

Hotell commented Apr 26, 2022

one issue I exposed is that basically slot props cannot be required. is that expected behaviour ?

image

Type '(props: {    greeting: string;    who: string;    children?: React.ReactNode;}) => React.DetailedReactHTMLElement<{ greeting: string; who: string; children?: React.ReactNode; }, HTMLElement>' does not satisfy the constraint 'keyof IntrinsicElements | ComponentType<{}> | UnknownSlotProps'.
  Type '(props: {    greeting: string;    who: string;    children?: React.ReactNode;}) => React.DetailedReactHTMLElement<{ greeting: string; who: string; children?: React.ReactNode; }, HTMLElement>' is not assignable to type 'FunctionComponent<{}>'.
    Types of parameters 'props' and 'props' are incompatible.
      Type '{ children?: ReactNode; }' is missing the following properties from type '{ greeting: string; who: string; children?: ReactNode; }': greeting, who ts(2344)

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 7397104:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@Hotell Hotell marked this pull request as ready for review April 26, 2022 13:37
@Hotell Hotell requested a review from a team as a code owner April 26, 2022 13:38
@fabricteam
Copy link
Collaborator

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-accordion
Accordion (including children components)
73.754 kB
22.494 kB
react-avatar
Avatar
45.196 kB
13.126 kB
react-badge
Badge
20.965 kB
6.605 kB
react-badge
CounterBadge
21.918 kB
6.919 kB
react-badge
PresenceBadge
22.005 kB
6.582 kB
react-button
Button
32.408 kB
8.986 kB
react-button
CompoundButton
38.635 kB
10.146 kB
react-button
MenuButton
34.175 kB
9.567 kB
react-button
SplitButton
41.431 kB
10.865 kB
react-button
ToggleButton
43.31 kB
9.921 kB
react-card
Card - All
57.884 kB
16.524 kB
react-card
Card
53.169 kB
15.238 kB
react-card
CardFooter
7.756 kB
3.299 kB
react-card
CardHeader
9.321 kB
3.816 kB
react-card
CardPreview
7.728 kB
3.323 kB
react-combobox
Combobox
60.564 kB
20.751 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
179.206 kB
50.033 kB
react-components
react-components: FluentProvider & webLightTheme
32.815 kB
10.717 kB
react-divider
Divider
15.455 kB
5.57 kB
react-image
Image
10.179 kB
3.995 kB
react-input
Input
21.775 kB
7.228 kB
react-label
Label
8.441 kB
3.541 kB
react-link
Link
11.176 kB
4.545 kB
react-menu
Menu (including children components)
110.192 kB
33.528 kB
react-menu
Menu (including selectable components)
113.367 kB
33.991 kB
react-popover
Popover
100.693 kB
30.67 kB
react-portal
Portal
6.272 kB
2.17 kB
react-positioning
usePopper
23.21 kB
8.084 kB
react-priority-overflow
hooks only
10.792 kB
4.125 kB
react-provider
FluentProvider
14.079 kB
5.274 kB
react-select
Select
16.616 kB
6.281 kB
react-slider
Slider
25.619 kB
8.287 kB
react-spinbutton
SpinButton
42.003 kB
11.886 kB
react-spinner
Spinner
17.224 kB
5.856 kB
react-switch
Switch
24.333 kB
8.019 kB
react-text
Text - Default
10.867 kB
4.269 kB
react-text
Text - Wrappers
14.183 kB
4.61 kB
react-textarea
Textarea
20.672 kB
7.07 kB
react-tooltip
Tooltip
42.907 kB
14.761 kB
react-utilities
SSRProvider
189 B
161 B
🤖 This report was generated against e45629a0978492d5a8a44934f5263e47862ac8b3

@fabricteam
Copy link
Collaborator

Perf Analysis (@fluentui/react-components)

Scenario Render type Master Ticks PR Ticks Iterations Status
FluentProviderWithTheme virtual-rerender-with-unmount 350 286 10 Possible regression
All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 907 919 5000
Button mount 545 552 5000
FluentProvider mount 1968 2002 5000
FluentProviderWithTheme mount 303 262 10
FluentProviderWithTheme virtual-rerender 234 235 10
FluentProviderWithTheme virtual-rerender-with-unmount 350 286 10 Possible regression
MakeStyles mount 1572 1550 50000

@size-auditor
Copy link

size-auditor bot commented Apr 26, 2022

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: e45629a0978492d5a8a44934f5263e47862ac8b3 (build)

@Hotell Hotell merged commit 837c5ff into microsoft:master May 3, 2022
@Hotell Hotell deleted the hotell/react-utilities/add-type-test-for-slot branch May 3, 2022 13:32
marwan38 pushed a commit to marwan38/fluentui that referenced this pull request Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants