Skip to content

Commit 63d4359

Browse files
authored
chore: TS update 5.8 (#8061)
1 parent 9fe5629 commit 63d4359

39 files changed

+184
-117
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/buffer.d.ts b/buffer.d.ts
2+
index 5d6c97d6b5d47fd189f795498aefd6b8d7713b7d..b9a22c4634fa6308006ae17d3527ff3c518a789d 100644
3+
--- a/buffer.d.ts
4+
+++ b/buffer.d.ts
5+
@@ -629,7 +629,7 @@ declare module "buffer" {
6+
*/
7+
poolSize: number;
8+
}
9+
- interface Buffer extends Uint8Array {
10+
+ interface Buffer extends Uint8Array<ArrayBuffer> {
11+
/**
12+
* Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did
13+
* not contain enough space to fit the entire string, only part of `string` will be

lib/viewTransitions.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,3 @@
1313
interface Document {
1414
startViewTransition(update: (() => void) | {update: () => void, types: string[]}): ViewTransition;
1515
}
16-
17-
interface ViewTransition {
18-
ready: Promise<void>;
19-
finished: Promise<void>;
20-
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
"tailwindcss": "^4.0.0",
207207
"tailwindcss-animate": "^1.0.7",
208208
"tempy": "^0.5.0",
209-
"typescript": "^5.5.0",
209+
"typescript": "^5.8.2",
210210
"typescript-eslint": "^8.9.0",
211211
"verdaccio": "^6.0.0",
212212
"walk-object": "^4.0.0",
@@ -234,7 +234,10 @@
234234
"recast": "0.23.6",
235235
"ast-types": "0.16.1",
236236
"svgo": "^3",
237-
"@testing-library/user-event": "patch:@testing-library/user-event@npm%3A14.6.1#~/.yarn/patches/@testing-library-user-event-npm-14.6.1-5da7e1d4e2.patch"
237+
"@testing-library/user-event": "patch:@testing-library/user-event@npm%3A14.6.1#~/.yarn/patches/@testing-library-user-event-npm-14.6.1-5da7e1d4e2.patch",
238+
"@types/node@npm:*": "patch:@types/node@npm%3A20.14.13#~/.yarn/patches/@types-node-npm-20.14.13-41f92d384c.patch",
239+
"@types/node@npm:^18.0.0": "patch:@types/node@npm%3A20.14.13#~/.yarn/patches/@types-node-npm-20.14.13-41f92d384c.patch",
240+
"@types/node@npm:>= 8": "patch:@types/node@npm%3A20.14.13#~/.yarn/patches/@types-node-npm-20.14.13-41f92d384c.patch"
238241
},
239242
"@parcel/transformer-css": {
240243
"cssModules": {

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

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

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

273-
if (state.selectionManager.selectionMode === 'none') {
274-
setInteractionModality('keyboard');
278+
// eslint-disable-next-line max-depth
279+
if (state.selectionManager.selectionMode === 'none') {
280+
setInteractionModality('keyboard');
281+
}
275282
}
276283
}
277284
} else if (
@@ -337,7 +344,7 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state:
337344
}, 50);
338345
}, [localState, defaultOnDrop, ref, updateFocusAfterDrop]);
339346

340-
347+
341348
useEffect(() => {
342349
return () => {
343350
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/calendar/stories/Calendar.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ const calendars = [
209209

210210
function Example(props) {
211211
let [locale, setLocale] = React.useState('');
212-
let [calendar, setCalendar] = React.useState<Key>(calendars[0].key);
212+
let [calendar, setCalendar] = React.useState<Key | null>(calendars[0].key);
213213
let {locale: defaultLocale} = useLocale();
214214

215215
let pref = preferences.find(p => p.locale === locale)!;

packages/@react-spectrum/datepicker/stories/DateField.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export const IsDateUnavailable: DateFieldStory = {
212212
...Default,
213213
args: {
214214
isDateUnavailable: (date) => {
215-
return date.compare(new CalendarDate(1980, 1, 1)) >= 0
215+
return date.compare(new CalendarDate(1980, 1, 1)) >= 0
216216
&& date.compare(new CalendarDate(1980, 1, 8)) <= 0;
217217
},
218218
errorMessage: 'Date unavailable.',
@@ -310,7 +310,7 @@ const calendars = [
310310

311311
function Example(props) {
312312
let [locale, setLocale] = React.useState('');
313-
let [calendar, setCalendar] = React.useState<Key>(calendars[0].key);
313+
let [calendar, setCalendar] = React.useState<Key | null>(calendars[0].key);
314314
let {locale: defaultLocale} = useLocale();
315315

316316
let pref = preferences.find(p => p.locale === locale);

packages/@react-spectrum/datepicker/stories/DatePicker.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ const calendars = [
338338

339339
function Example(props) {
340340
let [locale, setLocale] = React.useState('');
341-
let [calendar, setCalendar] = React.useState<Key>(calendars[0].key);
341+
let [calendar, setCalendar] = React.useState<Key | null>(calendars[0].key);
342342
let {locale: defaultLocale} = useLocale();
343343

344344
let pref = preferences.find(p => p.locale === locale);

packages/@react-spectrum/datepicker/stories/DateRangePicker.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ const calendars = [
238238

239239
function Example(props) {
240240
let [locale, setLocale] = React.useState('');
241-
let [calendar, setCalendar] = React.useState<Key>(calendars[0].key);
241+
let [calendar, setCalendar] = React.useState<Key | null>(calendars[0].key);
242242
let {locale: defaultLocale} = useLocale();
243243

244244
let pref = preferences.find(p => p.locale === locale);

packages/@react-spectrum/form/stories/Form.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ function FormWithControls(props: any = {}) {
482482
let [firstName, setFirstName] = useState('hello');
483483
let [isHunter, setIsHunter] = useState(true);
484484
let [favoritePet, setFavoritePet] = useState('cats');
485-
let [favoriteColor, setFavoriteColor] = useState('green' as Key);
485+
let [favoriteColor, setFavoriteColor] = useState<Key | null>('green');
486486
let [howIFeel, setHowIFeel] = useState('I feel good, o I feel so good!');
487487
let [birthday, setBirthday] = useState<CalendarDate | null>(new CalendarDate(1732, 2, 22));
488488
let [money, setMoney] = useState(50);

0 commit comments

Comments
 (0)