Skip to content

Commit 9d6cbc4

Browse files
committed
chore: update typescript to 5.8
1 parent 6672a12 commit 9d6cbc4

File tree

9 files changed

+72
-53
lines changed

9 files changed

+72
-53
lines changed

lib/viewTransitions.d.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
"tailwindcss": "^4.0.0",
208208
"tailwindcss-animate": "^1.0.7",
209209
"tempy": "^0.5.0",
210-
"typescript": "^5.5.0",
210+
"typescript": "^5.8.2",
211211
"typescript-eslint": "^8.9.0",
212212
"verdaccio": "^5.13.0",
213213
"walk-object": "^4.0.0",

packages/@react-aria/dnd/src/useDroppableCollection.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,25 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state:
258258
// inserted item. If selection is disabled, then also show the focus ring so there
259259
// is some indication that items were added.
260260
if (state.selectionManager.focusedKey === prevFocusedKey) {
261-
let first = newKeys.keys().next().value;
262-
let item = state.collection.getItem(first);
263-
264-
// If this is a cell, focus the parent row.
265-
if (item?.type === 'cell') {
266-
first = item.parentKey;
267-
}
261+
let first: Key | null | undefined = newKeys.keys().next().value;
262+
if (first != null) {
263+
let item = state.collection.getItem(first);
264+
265+
// If this is a cell, focus the parent row.
266+
// eslint-disable-next-line max-depth
267+
if (item?.type === 'cell') {
268+
first = item.parentKey;
269+
}
268270

269-
state.selectionManager.setFocusedKey(first);
271+
// eslint-disable-next-line max-depth
272+
if (first != null) {
273+
state.selectionManager.setFocusedKey(first);
274+
}
270275

271-
if (state.selectionManager.selectionMode === 'none') {
272-
setInteractionModality('keyboard');
276+
// eslint-disable-next-line max-depth
277+
if (state.selectionManager.selectionMode === 'none') {
278+
setInteractionModality('keyboard');
279+
}
273280
}
274281
}
275282
} else if (
@@ -335,7 +342,7 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state:
335342
}, 50);
336343
}, [localState, defaultOnDrop, ref, updateFocusAfterDrop]);
337344

338-
345+
339346
useEffect(() => {
340347
return () => {
341348
if (droppingState.current) {

packages/@react-aria/grid/src/useGridSelectionAnnouncement.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,25 @@ export function useGridSelectionAnnouncement<T>(props: GridSelectionAnnouncement
6161
let messages: string[] = [];
6262

6363
if ((state.selectionManager.selectedKeys.size === 1 && isReplace)) {
64-
if (state.collection.getItem(state.selectionManager.selectedKeys.keys().next().value)) {
65-
let currentSelectionText = getRowText(state.selectionManager.selectedKeys.keys().next().value);
64+
let firstKey = state.selectionManager.selectedKeys.keys().next().value;
65+
if (firstKey != null && state.collection.getItem(firstKey)) {
66+
let currentSelectionText = getRowText(firstKey);
6667
if (currentSelectionText) {
6768
messages.push(stringFormatter.format('selectedItem', {item: currentSelectionText}));
6869
}
6970
}
7071
} else if (addedKeys.size === 1 && removedKeys.size === 0) {
71-
let addedText = getRowText(addedKeys.keys().next().value);
72-
if (addedText) {
73-
messages.push(stringFormatter.format('selectedItem', {item: addedText}));
72+
let firstKey = addedKeys.keys().next().value;
73+
if (firstKey != null) {
74+
let addedText = getRowText(firstKey);
75+
if (addedText) {
76+
messages.push(stringFormatter.format('selectedItem', {item: addedText}));
77+
}
7478
}
7579
} else if (removedKeys.size === 1 && addedKeys.size === 0) {
76-
if (state.collection.getItem(removedKeys.keys().next().value)) {
77-
let removedText = getRowText(removedKeys.keys().next().value);
80+
let firstKey = removedKeys.keys().next().value;
81+
if (firstKey != null && state.collection.getItem(firstKey)) {
82+
let removedText = getRowText(firstKey);
7883
if (removedText) {
7984
messages.push(stringFormatter.format('deselectedItem', {item: removedText}));
8085
}

packages/@react-spectrum/s2/src/SegmentedControl.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,17 @@ export const SegmentedControl = /*#__PURE__*/ forwardRef(function SegmentedContr
170170
if (currentSelectedRef.current) {
171171
prevRef.current = currentSelectedRef?.current.getBoundingClientRect();
172172
}
173-
173+
174174
if (onSelectionChange) {
175-
onSelectionChange(values.values().next().value);
175+
let firstKey = values.values().next().value;
176+
if (firstKey != null) {
177+
onSelectionChange(firstKey);
178+
}
176179
}
177180
};
178181

179182
return (
180-
<ToggleButtonGroup
183+
<ToggleButtonGroup
181184
{...props}
182185
selectedKeys={selectedKey != null ? [selectedKey] : undefined}
183186
defaultSelectedKeys={defaultSelectedKey != null ? [defaultSelectedKey] : undefined}
@@ -211,7 +214,7 @@ function DefaultSelectionTracker(props: DefaultSelectionTrackProps) {
211214
<Provider
212215
values={[
213216
[InternalSegmentedControlContext, {register: register, prevRef: props.prevRef, currentSelectedRef: props.currentSelectedRef, isJustified: props.isJustified}]
214-
]}>
217+
]}>
215218
{props.children}
216219
</Provider>
217220
);
@@ -255,15 +258,15 @@ export const SegmentedControlItem = /*#__PURE__*/ forwardRef(function SegmentedC
255258
}, [isSelected, reduceMotion]);
256259

257260
return (
258-
<ToggleButton
261+
<ToggleButton
259262
{...props}
260-
ref={domRef}
263+
ref={domRef}
261264
style={props.UNSAFE_style}
262265
className={renderProps => (props.UNSAFE_className || '') + controlItem({...renderProps, isJustified}, props.styles)} >
263266
{({isSelected, isPressed, isDisabled}) => (
264267
<>
265268
{isSelected && <div className={slider({isDisabled})} ref={currentSelectedRef} />}
266-
<Provider
269+
<Provider
267270
values={[
268271
[IconContext, {
269272
render: centerBaseline({slot: 'icon', styles: style({order: 0, flexShrink: 0})})

packages/@react-stately/disclosure/src/useDisclosureGroupState.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface DisclosureGroupState {
3333

3434
/** Whether all items are disabled. */
3535
readonly isDisabled: boolean,
36-
36+
3737
/** A set of keys for items that are expanded. */
3838
readonly expandedKeys: Set<Key>,
3939

@@ -55,11 +55,14 @@ export function useDisclosureGroupState(props: DisclosureGroupProps): Disclosure
5555
useMemo(() => props.defaultExpandedKeys ? new Set(props.defaultExpandedKeys) : new Set(), [props.defaultExpandedKeys]),
5656
props.onExpandedChange
5757
);
58-
58+
5959
useEffect(() => {
6060
// Ensure only one item is expanded if allowsMultipleExpanded is false.
6161
if (!allowsMultipleExpanded && expandedKeys.size > 1) {
62-
setExpandedKeys(new Set([expandedKeys.values().next().value]));
62+
let firstKey = expandedKeys.values().next().value;
63+
if (firstKey != null) {
64+
setExpandedKeys(new Set([firstKey]));
65+
}
6366
}
6467
});
6568

@@ -80,7 +83,7 @@ export function useDisclosureGroupState(props: DisclosureGroupProps): Disclosure
8083
} else {
8184
keys = new Set(expandedKeys.has(key) ? [] : [key]);
8285
}
83-
86+
8487
setExpandedKeys(keys);
8588
}
8689
};

packages/@react-types/shared/src/selection.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface SingleSelection {
2020
/** The initial selected key in the collection (uncontrolled). */
2121
defaultSelectedKey?: Key,
2222
/** Handler that is called when the selection changes. */
23-
onSelectionChange?: (key: Key) => void
23+
onSelectionChange?: (key: Key | null) => void
2424
}
2525

2626
export type SelectionMode = 'none' | 'single' | 'multiple';

packages/dev/codemods/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},
3939
"devDependencies": {
4040
"@types/jscodeshift": "^0.11.11",
41-
"typescript": "^5.5.0"
41+
"typescript": "^5.8.2"
4242
},
4343
"peerDependencies": {
4444
"react": "^18.0.0 || ^19.0.0-rc.1",

yarn.lock

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7148,7 +7148,7 @@ __metadata:
71487148
jscodeshift: "npm:^0.15.2"
71497149
recast: "npm:^0.23.9"
71507150
ts-node: "npm:^10.9.2"
7151-
typescript: "npm:^5.5.0"
7151+
typescript: "npm:^5.8.2"
71527152
uuid: "npm:^9.0.1"
71537153
peerDependencies:
71547154
react: ^18.0.0 || ^19.0.0-rc.1
@@ -29399,7 +29399,7 @@ __metadata:
2939929399
tailwindcss: "npm:^4.0.0"
2940029400
tailwindcss-animate: "npm:^1.0.7"
2940129401
tempy: "npm:^0.5.0"
29402-
typescript: "npm:^5.5.0"
29402+
typescript: "npm:^5.8.2"
2940329403
typescript-eslint: "npm:^8.9.0"
2940429404
verdaccio: "npm:^5.13.0"
2940529405
walk-object: "npm:^4.0.0"
@@ -33316,6 +33316,16 @@ __metadata:
3331633316
languageName: node
3331733317
linkType: hard
3331833318

33319+
"typescript@npm:^5.8.2":
33320+
version: 5.8.2
33321+
resolution: "typescript@npm:5.8.2"
33322+
bin:
33323+
tsc: bin/tsc
33324+
tsserver: bin/tsserver
33325+
checksum: 10c0/5c4f6fbf1c6389b6928fe7b8fcd5dc73bb2d58cd4e3883f1d774ed5bd83b151cbac6b7ecf11723de56d4676daeba8713894b1e9af56174f2f9780ae7848ec3c6
33326+
languageName: node
33327+
linkType: hard
33328+
3331933329
"typescript@patch:typescript@npm%3A^5.5.0#optional!builtin<compat/typescript>":
3332033330
version: 5.5.2
3332133331
resolution: "typescript@patch:typescript@npm%3A5.5.2#optional!builtin<compat/typescript>::version=5.5.2&hash=b45daf"
@@ -33326,6 +33336,16 @@ __metadata:
3332633336
languageName: node
3332733337
linkType: hard
3332833338

33339+
"typescript@patch:typescript@npm%3A^5.8.2#optional!builtin<compat/typescript>":
33340+
version: 5.8.2
33341+
resolution: "typescript@patch:typescript@npm%3A5.8.2#optional!builtin<compat/typescript>::version=5.8.2&hash=b45daf"
33342+
bin:
33343+
tsc: bin/tsc
33344+
tsserver: bin/tsserver
33345+
checksum: 10c0/8a6cd29dfb59bd5a978407b93ae0edb530ee9376a5b95a42ad057a6f80ffb0c410489ccd6fe48d1d0dfad6e8adf5d62d3874bbd251f488ae30e11a1ce6dabd28
33346+
languageName: node
33347+
linkType: hard
33348+
3332933349
"ua-parser-js@npm:0.7.17":
3333033350
version: 0.7.17
3333133351
resolution: "ua-parser-js@npm:0.7.17"

0 commit comments

Comments
 (0)