Skip to content

Commit 4a81059

Browse files
Upgrade TypeScript to v4.9.3 (#7271)
1 parent db2cc1a commit 4a81059

File tree

8 files changed

+26
-32
lines changed

8 files changed

+26
-32
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"stylelint": "^14.15.0",
8585
"ts-node": "^10.7.0",
8686
"turbo": "^1.2.8",
87-
"typescript": "^4.6.3"
87+
"typescript": "^4.9.3"
8888
},
8989
"prettier": "@shopify/prettier-config",
9090
"size-limit": [

polaris-cli/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
"@oclif/core": "^1.13.10",
2727
"@shopify/polaris-migrator": "^0.11.3"
2828
},
29-
"devDependencies": {
30-
"typescript": "^4.7.4"
31-
},
3229
"engine-strict": true,
3330
"engines": {
3431
"node": "^16.13.0 || >=18.12.0"

polaris-react/src/components/OptionList/tests/OptionList.test.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,8 @@ function firstOption(
539539
options?: OptionDescriptor[],
540540
sections?: OptionListProps['sections'],
541541
): string {
542-
const firstOptionsValue =
543-
options == null || options === [] ? '' : options[0].value;
544-
const firstSectionOptionsValue =
545-
sections == null || sections === [] || sections[0].options === []
546-
? ''
547-
: sections[0].options[0].value;
542+
const firstOptionsValue = options?.[0]?.value ?? '';
543+
const firstSectionOptionsValue = sections?.[0]?.options?.[0]?.value ?? '';
548544
return firstOptionsValue || firstSectionOptionsValue;
549545
}
550546

polaris-react/src/components/ResourceList/ResourceList.tsx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, {
2-
ReactElement,
32
useCallback,
43
useEffect,
54
useReducer,
@@ -41,7 +40,11 @@ import styles from './ResourceList.scss';
4140
const SMALL_SPINNER_HEIGHT = 28;
4241
const LARGE_SPINNER_HEIGHT = 45;
4342

44-
function getAllItemsOnPage<TItemType>(
43+
interface ResourceListItemData {
44+
[data: string]: any;
45+
}
46+
47+
function getAllItemsOnPage<TItemType extends ResourceListItemData>(
4548
items: TItemType[],
4649
idForItem: (item: TItemType, index: number) => string,
4750
) {
@@ -57,16 +60,16 @@ const isBreakpointsXS = () => {
5760
parseFloat(toPx(tokens.breakpoints['breakpoints-sm']) ?? '');
5861
};
5962

60-
function defaultIdForItem<TItemType extends {id?: any}>(
63+
function defaultIdForItem<TItemType extends ResourceListItemData>(
6164
item: TItemType,
6265
index: number,
63-
) {
64-
return Object.prototype.hasOwnProperty.call(item, 'id')
65-
? item.id
66-
: index.toString();
66+
): string {
67+
return 'id' in item ? item.id : index.toString();
6768
}
6869

69-
export interface ResourceListProps<TItemType = any> {
70+
export interface ResourceListProps<
71+
TItemType extends ResourceListItemData = ResourceListItemData,
72+
> {
7073
/** Item data; each item is passed to renderItem */
7174
items: TItemType[];
7275
filterControl?: React.ReactNode;
@@ -119,13 +122,7 @@ export interface ResourceListProps<TItemType = any> {
119122
resolveItemId?(item: TItemType): string;
120123
}
121124

122-
type ResourceListType = (<TItemType>(
123-
value: ResourceListProps<TItemType>,
124-
) => ReactElement) & {
125-
Item: typeof ResourceItem;
126-
};
127-
128-
export const ResourceList: ResourceListType = function ResourceList<TItemType>({
125+
export function ResourceList<TItemType extends ResourceListItemData>({
129126
items,
130127
filterControl,
131128
emptyState,
@@ -767,6 +764,6 @@ export const ResourceList: ResourceListType = function ResourceList<TItemType>({
767764
<div ref={bulkActionsIntersectionRef} />
768765
</ResourceListContext.Provider>
769766
);
770-
};
767+
}
771768

772769
ResourceList.Item = ResourceItem;

polaris-react/src/utilities/merge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function merge<TSource1, TSource2, TSource3, TSource4, TSource5>(
3030
let final = {};
3131

3232
for (const obj of objs) {
33-
final = mergeRecursively(final, obj);
33+
final = mergeRecursively(final, obj as any);
3434
}
3535

3636
return final;

polaris.shopify.com/content/design/typography.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ Small heading styles, `headingXs` - `headingMd`, and body styles will remain the
123123

124124
![An image showing how heading styles change based on breakpoint](/images/foundations/design/typography/type-responsive-styles@2x.png)
125125

126+
### Uppercase styles
127+
128+
The design language no longer supports uppercase typography. We recommend using the [Text component](/components/text) to apply visual hierarchy. Work with your team to determine a type style that works best for your use case.
129+
126130
---
127131

128132
## Font stack

polaris.shopify.com/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@
7070
"rehype-raw": "^6.1.1",
7171
"sass": "^1.49.9",
7272
"style-loader": "^3.3.1",
73-
"typescript": "^4.7.4"
73+
"typescript": "^4.9.3"
7474
}
7575
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21679,10 +21679,10 @@ typedarray@^0.0.6:
2167921679
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
2168021680
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
2168121681

21682-
typescript@^4.3.2, typescript@^4.6.3, typescript@^4.7.4:
21683-
version "4.8.4"
21684-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6"
21685-
integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==
21682+
typescript@^4.3.2, typescript@^4.9.3:
21683+
version "4.9.3"
21684+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db"
21685+
integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==
2168621686

2168721687
typical@^4.0.0:
2168821688
version "4.0.0"

0 commit comments

Comments
 (0)