Skip to content

Commit e2a30fe

Browse files
authored
chore: fix tsc build errors in latest @types/react (#7482)
1 parent d05a8ec commit e2a30fe

File tree

9 files changed

+32
-16
lines changed

9 files changed

+32
-16
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"@types/glob": "^7.2.0",
120120
"@types/lodash": "^4.17.7",
121121
"@types/node": "^18.19.8",
122-
"@types/react": "^18.3.3",
122+
"@types/react": "^18.3.5",
123123
"@types/semver": "^7.5.6",
124124
"@types/yargs": "^17.0.7",
125125
"@typescript-eslint/eslint-plugin": "^7.18.0",

packages/@sanity/block-tools/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"dependencies": {
5252
"@sanity/types": "3.57.1",
53-
"@types/react": "^18.3.3",
53+
"@types/react": "^18.3.5",
5454
"get-random-values-esm": "1.0.2",
5555
"lodash": "^4.17.21"
5656
},

packages/@sanity/schema/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"@sanity/icons": "^3.4.0",
7979
"@types/arrify": "^1.0.4",
8080
"@types/object-inspect": "^1.13.0",
81-
"@types/react": "^18.3.3",
81+
"@types/react": "^18.3.5",
8282
"rimraf": "^3.0.2"
8383
}
8484
}

packages/@sanity/types/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"dependencies": {
5252
"@sanity/client": "^6.21.3",
53-
"@types/react": "^18.3.3"
53+
"@types/react": "^18.3.5"
5454
},
5555
"devDependencies": {
5656
"@jest/globals": "^29.7.0",

packages/sanity/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
"@tanstack/react-table": "^8.16.0",
185185
"@tanstack/react-virtual": "3.0.0-beta.54",
186186
"@types/react-copy-to-clipboard": "^5.0.2",
187-
"@types/react-is": "^18.2.0",
187+
"@types/react-is": "^18.3.0",
188188
"@types/shallow-equals": "^1.0.0",
189189
"@types/speakingurl": "^13.0.3",
190190
"@types/tar-stream": "^3.1.3",
@@ -290,7 +290,7 @@
290290
"@types/log-symbols": "^2.0.0",
291291
"@types/node": "^18.19.8",
292292
"@types/raf": "^3.4.0",
293-
"@types/react": "^18.3.3",
293+
"@types/react": "^18.3.5",
294294
"@types/react-dom": "^18.3.0",
295295
"@types/refractor": "^3.0.0",
296296
"@types/resolve-from": "^4.0.0",

packages/sanity/src/core/form/inputs/arrays/common/uploadTarget/uploadTarget.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import {
55
type ComponentType,
66
type ForwardedRef,
77
forwardRef,
8+
type ForwardRefExoticComponent,
9+
type PropsWithoutRef,
810
type ReactNode,
11+
type RefAttributes,
912
useCallback,
1013
useState,
1114
} from 'react'
@@ -52,9 +55,15 @@ function getUploadCandidates(
5255
}))
5356
.filter((member) => member.uploader) as ResolvedUploader[]
5457
}
55-
export function uploadTarget<Props>(Component: ComponentType<Props>) {
58+
59+
export function uploadTarget<Props>(
60+
Component: ComponentType<Props>,
61+
): ForwardRefExoticComponent<
62+
PropsWithoutRef<UploadTargetProps & Props> & RefAttributes<HTMLElement>
63+
> {
5664
const FileTarget = fileTarget<FIXME>(Component)
5765

66+
// @ts-expect-error TODO fix PropsWithoutRef related union typings
5867
return forwardRef(function UploadTarget(
5968
props: UploadTargetProps & Props,
6069
forwardedRef: ForwardedRef<HTMLElement>,

packages/sanity/src/core/form/inputs/common/fileTarget/fileTarget.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import {
44
type DragEvent,
55
type ForwardedRef,
66
forwardRef,
7+
type ForwardRefExoticComponent,
78
type KeyboardEvent,
9+
type PropsWithoutRef,
10+
type RefAttributes,
811
useCallback,
912
useEffect,
1013
useImperativeHandle,
@@ -68,13 +71,17 @@ const PASTE_INPUT_STYLE = {opacity: 0, position: 'absolute'} as const
6871
* Higher order component that creates a file target from a given component.
6972
* Returns a component that acts both as a drop target and a paste target, emitting a list of Files upon drop or paste
7073
*/
71-
export function fileTarget<ComponentProps>(Component: ComponentType<ComponentProps>) {
74+
export function fileTarget<ComponentProps>(
75+
Component: ComponentType<ComponentProps>,
76+
): ForwardRefExoticComponent<
77+
PropsWithoutRef<Omit<ComponentProps, ManagedProps> & Props> & RefAttributes<HTMLElement>
78+
> {
79+
// @ts-expect-error TODO fix PropsWithoutRef related union typings
7280
return forwardRef(function FileTarget(
7381
props: Omit<ComponentProps, ManagedProps> & Props,
7482
forwardedRef: ForwardedRef<HTMLElement>,
7583
) {
7684
const {onFiles, onFilesOver, onFilesOut, disabled, ...rest} = props
77-
7885
const [showPasteInput, setShowPasteInput] = useState(false)
7986

8087
const pasteInput = useRef<HTMLDivElement | null>(null)

packages/sanity/src/core/studio/components/navbar/free-trial/FreeTrialButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const FreeTrialButtonTopbar = forwardRef(function FreeTrialButtonTopbar(
9393
})
9494

9595
export const FreeTrialButtonSidebar = forwardRef(function FreeTrialButtonSidebar(
96-
{toggleShowContent, daysLeft}: Omit<FreeTrialButtonProps, 'totalDays'>,
96+
{toggleShowContent, daysLeft}: Pick<FreeTrialButtonProps, 'toggleShowContent' | 'daysLeft'>,
9797
ref: Ref<HTMLButtonElement>,
9898
) {
9999
const {t} = useTranslation()

pnpm-lock.yaml

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)