Skip to content

Commit

Permalink
deprecate IObserver options and its properties in JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
imjordanxd committed Oct 14, 2024
1 parent 77e3a13 commit 71f03ee
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/mobx-react-lite/src/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,27 @@ const ReactMemoSymbol = hasSymbol
? Symbol.for("react.memo")
: typeof memo === "function" && memo((props: any) => null)["$$typeof"]

/**
* @deprecated Observer options will be removed in the next major version of mobx-react-lite.
* Look at the individual properties for alternatives.
*/
export interface IObserverOptions {
/**
* @deprecated Pass a `React.forwardRef` component to observer instead of using the options object
* e.g. `observer(React.forwardRef(fn))`
*/
readonly forwardRef?: boolean
}

export function observer<P extends object, TRef = {}>(
baseComponent: React.ForwardRefRenderFunction<TRef, P>,
options: IObserverOptions & { forwardRef: true }
options: IObserverOptions & {
/**
* @deprecated Pass a `React.forwardRef` component to observer instead of using the options object
* e.g. `observer(React.forwardRef(fn))`
*/
forwardRef: true
}
): React.MemoExoticComponent<
React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>
>
Expand Down

0 comments on commit 71f03ee

Please sign in to comment.