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

Make ref types' current property non-optional #2803

Merged
merged 1 commit into from
Oct 19, 2020
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
7 changes: 2 additions & 5 deletions hooks/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function useReducer<S, A, I>(
init: (arg: I) => S
): [S, (action: A) => void];

type PropRef<T> = { current?: T };
type PropRef<T> = { current: T };
type Ref<T> = { current: T };

/**
Expand Down Expand Up @@ -123,10 +123,7 @@ export function useContext<T>(context: PreactContext<T>): T;
* @param value Custom hook name or object that is passed to formatter
* @param formatter Formatter to modify value before sending it to the devtools
*/
export function useDebugValue<T>(
value: T,
formatter?: (value: T) => any
): void;
export function useDebugValue<T>(value: T, formatter?: (value: T) => any): void;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was prettier's doing.


export function useErrorBoundary(
callback?: (error: any) => Promise<void> | void
Expand Down
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare namespace preact {

type Key = string | number | any;

type RefObject<T> = { current?: T | null };
type RefObject<T> = { current: T | null };
type RefCallback<T> = (instance: T | null) => void;
type Ref<T> = RefObject<T> | RefCallback<T>;

Expand Down