Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix tsc build errors in latest @types/react #7482

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"@types/glob": "^7.2.0",
"@types/lodash": "^4.17.7",
"@types/node": "^18.19.8",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"@types/semver": "^7.5.6",
"@types/yargs": "^17.0.7",
"@typescript-eslint/eslint-plugin": "^7.18.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/block-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"dependencies": {
"@sanity/types": "3.57.1",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"get-random-values-esm": "1.0.2",
"lodash": "^4.17.21"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@sanity/icons": "^3.4.0",
"@types/arrify": "^1.0.4",
"@types/object-inspect": "^1.13.0",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"rimraf": "^3.0.2"
}
}
2 changes: 1 addition & 1 deletion packages/@sanity/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"dependencies": {
"@sanity/client": "^6.21.3",
"@types/react": "^18.3.3"
"@types/react": "^18.3.5"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/sanity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
"@tanstack/react-table": "^8.16.0",
"@tanstack/react-virtual": "3.0.0-beta.54",
"@types/react-copy-to-clipboard": "^5.0.2",
"@types/react-is": "^18.2.0",
"@types/react-is": "^18.3.0",
"@types/shallow-equals": "^1.0.0",
"@types/speakingurl": "^13.0.3",
"@types/tar-stream": "^3.1.3",
Expand Down Expand Up @@ -290,7 +290,7 @@
"@types/log-symbols": "^2.0.0",
"@types/node": "^18.19.8",
"@types/raf": "^3.4.0",
"@types/react": "^18.3.3",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@types/refractor": "^3.0.0",
"@types/resolve-from": "^4.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import {
type ComponentType,
type ForwardedRef,
forwardRef,
type ForwardRefExoticComponent,
type PropsWithoutRef,
type ReactNode,
type RefAttributes,
useCallback,
useState,
} from 'react'
Expand Down Expand Up @@ -52,9 +55,15 @@ function getUploadCandidates(
}))
.filter((member) => member.uploader) as ResolvedUploader[]
}
export function uploadTarget<Props>(Component: ComponentType<Props>) {

export function uploadTarget<Props>(
Component: ComponentType<Props>,
): ForwardRefExoticComponent<
PropsWithoutRef<UploadTargetProps & Props> & RefAttributes<HTMLElement>
> {
const FileTarget = fileTarget<FIXME>(Component)

// @ts-expect-error TODO fix PropsWithoutRef related union typings
return forwardRef(function UploadTarget(
props: UploadTargetProps & Props,
forwardedRef: ForwardedRef<HTMLElement>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import {
type DragEvent,
type ForwardedRef,
forwardRef,
type ForwardRefExoticComponent,
type KeyboardEvent,
type PropsWithoutRef,
type RefAttributes,
useCallback,
useEffect,
useImperativeHandle,
Expand Down Expand Up @@ -68,13 +71,17 @@ const PASTE_INPUT_STYLE = {opacity: 0, position: 'absolute'} as const
* Higher order component that creates a file target from a given component.
* Returns a component that acts both as a drop target and a paste target, emitting a list of Files upon drop or paste
*/
export function fileTarget<ComponentProps>(Component: ComponentType<ComponentProps>) {
export function fileTarget<ComponentProps>(
Component: ComponentType<ComponentProps>,
): ForwardRefExoticComponent<
PropsWithoutRef<Omit<ComponentProps, ManagedProps> & Props> & RefAttributes<HTMLElement>
> {
// @ts-expect-error TODO fix PropsWithoutRef related union typings
return forwardRef(function FileTarget(
props: Omit<ComponentProps, ManagedProps> & Props,
forwardedRef: ForwardedRef<HTMLElement>,
) {
const {onFiles, onFilesOver, onFilesOut, disabled, ...rest} = props

const [showPasteInput, setShowPasteInput] = useState(false)

const pasteInput = useRef<HTMLDivElement | null>(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const FreeTrialButtonTopbar = forwardRef(function FreeTrialButtonTopbar(
})

export const FreeTrialButtonSidebar = forwardRef(function FreeTrialButtonSidebar(
{toggleShowContent, daysLeft}: Omit<FreeTrialButtonProps, 'totalDays'>,
{toggleShowContent, daysLeft}: Pick<FreeTrialButtonProps, 'toggleShowContent' | 'daysLeft'>,
ref: Ref<HTMLButtonElement>,
) {
const {t} = useTranslation()
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading