Skip to content

fix(react-northstar, react-bindings, react-builder): Fix build errors in TypeScript 5.3.3#30817

Merged
behowell merged 1 commit intomicrosoft:masterfrom
behowell:ts5/react-northstar
Mar 21, 2024
Merged

fix(react-northstar, react-bindings, react-builder): Fix build errors in TypeScript 5.3.3#30817
behowell merged 1 commit intomicrosoft:masterfrom
behowell:ts5/react-northstar

Conversation

@behowell
Copy link
Contributor

@behowell behowell commented Mar 18, 2024

Previous Behavior

TypeScript 5 introduced some breaking changes to the way that implicit type coercion happens in templates, as well as a few other breaking changes. Although we don't currently use TypeScript 5.3.3 in the repo, experimental work in the xplat branch requires building against TypesScript 5+. There are also customers using TypeScript 5+, who are seeing build errors when importing FluentUI.

New Behavior

Fix build errors seen if the repo is updated to TypeScript 5.3.3. This is part of a set of PRs intending to fix all build errors when building against TypeScript 5.3.3.

The fixes fall into a few major categories:

  1. Breaking change in TS 4.8: Unconstrained Generics No Longer Assignable to {}.
    • Fixed by adding extends {} constraint to template types that previously had no constraint (effectively extends unknown). The new constraint disallows null and undefined as template parameters, which were never valid values for these type parameters anyways.
      -export type SlotProp<TProps> =
      +export type SlotProp<TProps extends {}> =
  2. Breaking change in TS 4.8: Unused Renames in Binding Patterns are Now Errors in Type Signatures.
    • Fixed by adding a parameter name that was accidentally omitted from function definitions:
      -  onPropUpdate: ({ jsonTreeElement: JSONTreeElement }) => void;
      +  onPropUpdate: (args: { jsonTreeElement: JSONTreeElement }) => void;
  3. Breaking change in TS 5.0: Forbidden Implicit Coercions in Relational Operators (effectively: can't use <=, >, etc. between Number and number values).
    • Most cases of this appear to be a typo: a function returning Number when it should have been returning number.
      -export function compareDatePart(date1: Date, date2: Date): Number {
      +export function compareDatePart(date1: Date, date2: Date): number {

ℹ️ Note: This is NOT updating the project to use TypeScript 5.3.3, and an update to the TypeScript version is not planned as part of this change. It is only fixing build errors that would occur if it were built against TypeScript 5.3.3.

Related Issue(s)

This PR was split out from a monolith PR that contains all of the changes. I'm not going to publish the monolith PR, but in case it helps to see all of the changes in one place:

Here are all of the split-out PRs:

@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.

@fabricteam
Copy link
Collaborator

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-northstar
Accordion
85.392 kB
26.518 kB
react-northstar
Alert
87.45 kB
26.902 kB
react-northstar
Animation
55.34 kB
17.829 kB
react-northstar
Attachment
86.844 kB
26.692 kB
react-northstar
Avatar
80.279 kB
24.629 kB
react-northstar
Box
75.248 kB
23.806 kB
react-northstar
Breadcrumb
79.92 kB
24.709 kB
react-northstar
Button
83.16 kB
25.947 kB
react-northstar
Card
82.705 kB
25.023 kB
react-northstar
Carousel
105.182 kB
31.871 kB
react-northstar
Chat
152.378 kB
45.964 kB
react-northstar
Checkbox
79.807 kB
25.078 kB
react-northstar
Datepicker
184.939 kB
56.194 kB
react-northstar
Debug
8.801 kB
3.594 kB
react-northstar
Design
36.589 kB
12.067 kB
react-northstar
Dialog
112.058 kB
33.615 kB
react-northstar
Divider
76.619 kB
24.129 kB
react-northstar
Dropdown
196.499 kB
59.455 kB
react-northstar
Embed
81.477 kB
25.417 kB
react-northstar
Flex
47.728 kB
15.438 kB
react-northstar
Form
92.527 kB
28.879 kB
react-northstar
Grid
70.584 kB
22.278 kB
react-northstar
Header
74.756 kB
23.461 kB
react-northstar
Image
73.591 kB
23.329 kB
react-northstar
Input
88.346 kB
27.78 kB
react-northstar
ItemLayout
78.231 kB
24.454 kB
react-northstar
Label
77.92 kB
24.41 kB
react-northstar
Layout
75.393 kB
23.798 kB
react-northstar
List
88.493 kB
27.547 kB
react-northstar
Loader
78.616 kB
24.729 kB
react-northstar
Menu
126.89 kB
39.872 kB
react-northstar
MenuButton
161.296 kB
48.883 kB
react-northstar
Pill
83.722 kB
26.069 kB
react-northstar
Popup
133.604 kB
41.483 kB
react-northstar
Portal
58.338 kB
18.852 kB
react-northstar
Provider
93.138 kB
29.63 kB
react-northstar
RadioGroup
83.282 kB
26.053 kB
react-northstar
Reaction
77.28 kB
24.122 kB
react-northstar
Segment
76.209 kB
23.892 kB
react-northstar
Skeleton
77.765 kB
24.2 kB
react-northstar
Slider
84.27 kB
26.737 kB
react-northstar
SplitButton
176.534 kB
52.63 kB
react-northstar
Status
76.272 kB
24.05 kB
react-northstar
SvgIcon
36.823 kB
11.743 kB
react-northstar
Table
80.796 kB
25.154 kB
react-northstar
Text
74.114 kB
23.507 kB
react-northstar
TextArea
74.248 kB
23.492 kB
react-northstar
Toolbar
173.345 kB
52.08 kB
react-northstar
Tooltip
108.261 kB
34.482 kB
react-northstar
Tree
87.855 kB
27.217 kB
react-northstar
Video
75.411 kB
23.799 kB
🤖 This report was generated against 5e690201797c6b1ce34ac59638fd4a77a0f5a2b3

@fabricteam
Copy link
Collaborator

🕵 FluentUIV0 No visual regressions between this PR and main

@fabricteam
Copy link
Collaborator

Perf Analysis (@fluentui/react-northstar)

⚠️ 1 potential perf regressions detected

Potential regressions comparing to master

Scenario Current PR Ticks Baseline Ticks Ratio Regression Analysis
AttachmentMinimalPerf.default 85 77 1.1:1 analysis
Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
ButtonMinimalPerf.default 96 84 1.14:1
ChatDuplicateMessagesPerf.default 161 142 1.13:1
ChatWithPopoverPerf.default 191 179 1.07:1
LoaderMinimalPerf.default 200 187 1.07:1
TreeWith60ListItems.default 91 85 1.07:1
BoxMinimalPerf.default 199 187 1.06:1
HeaderSlotsPerf.default 469 442 1.06:1
ListMinimalPerf.default 319 301 1.06:1
PortalMinimalPerf.default 91 86 1.06:1
SkeletonMinimalPerf.default 210 198 1.06:1
TreeMinimalPerf.default 497 470 1.06:1
CardMinimalPerf.default 318 302 1.05:1
ListNestedPerf.default 329 312 1.05:1
CarouselMinimalPerf.default 266 256 1.04:1
GridMinimalPerf.default 195 187 1.04:1
LabelMinimalPerf.default 225 216 1.04:1
SplitButtonMinimalPerf.default 2332 2234 1.04:1
ButtonSlotsPerf.default 318 308 1.03:1
DialogMinimalPerf.default 457 444 1.03:1
EmbedMinimalPerf.default 1930 1866 1.03:1
InputMinimalPerf.default 536 521 1.03:1
MenuButtonMinimalPerf.default 966 941 1.03:1
RadioGroupMinimalPerf.default 270 262 1.03:1
ReactionMinimalPerf.default 215 209 1.03:1
ToolbarMinimalPerf.default 553 537 1.03:1
DropdownManyItemsPerf.default 401 395 1.02:1
FormMinimalPerf.default 234 229 1.02:1
ItemLayoutMinimalPerf.default 717 705 1.02:1
MenuMinimalPerf.default 509 498 1.02:1
ProviderMergeThemesPerf.default 661 645 1.02:1
ProviderMinimalPerf.default 202 198 1.02:1
TableMinimalPerf.default 242 238 1.02:1
TooltipMinimalPerf.default 1321 1294 1.02:1
DatepickerMinimalPerf.default 3711 3686 1.01:1
DropdownMinimalPerf.default 1440 1428 1.01:1
SliderMinimalPerf.default 741 734 1.01:1
AnimationMinimalPerf.default 290 290 1:1
AvatarMinimalPerf.default 105 105 1:1
ChatMinimalPerf.default 443 444 1:1
DividerMinimalPerf.default 208 209 1:1
AttachmentSlotsPerf.default 648 655 0.99:1
CheckboxMinimalPerf.default 1112 1123 0.99:1
HeaderMinimalPerf.default 204 206 0.99:1
PopupMinimalPerf.default 354 357 0.99:1
StatusMinimalPerf.default 395 401 0.99:1
TextMinimalPerf.default 186 187 0.99:1
CustomToolbarPrototype.default 1481 1490 0.99:1
FlexMinimalPerf.default 157 160 0.98:1
ImageMinimalPerf.default 221 225 0.98:1
ListWith60ListItems.default 361 370 0.98:1
RefMinimalPerf.default 104 106 0.98:1
IconMinimalPerf.default 367 374 0.98:1
LayoutMinimalPerf.default 198 204 0.97:1
RosterPerf.default 1600 1658 0.97:1
TableManyItemsPerf.default 1104 1137 0.97:1
TextAreaMinimalPerf.default 285 293 0.97:1
ButtonOverridesMissPerf.default 629 652 0.96:1
SegmentMinimalPerf.default 192 200 0.96:1
VideoMinimalPerf.default 428 447 0.96:1
AccordionMinimalPerf.default 84 88 0.95:1
AlertMinimalPerf.default 150 161 0.93:1
ListCommonPerf.default 383 416 0.92:1

@behowell behowell marked this pull request as ready for review March 20, 2024 16:03
@behowell behowell requested a review from a team as a code owner March 20, 2024 16:03
@behowell behowell merged commit 5bbfacb into microsoft:master Mar 21, 2024
@behowell behowell deleted the ts5/react-northstar branch March 21, 2024 19:30
robertpenner pushed a commit to robertpenner/fluentui that referenced this pull request Apr 11, 2024
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.

3 participants