-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: ignore checkbox input native size prop * perf: prevent layout calc for scrollbar size 0 * fix: as component function types
- Loading branch information
Showing
4 changed files
with
40 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { ElementType, forwardRef, ReactElement } from "react"; | ||
import { ComponentProps, AsProp, RefOfType } from "./types"; | ||
import { AsInProps, AsOutProps, RefOfType } from "./types"; | ||
|
||
export const as = <T extends ElementType, ExtraProps = unknown>( | ||
export const as = <DefaultType extends ElementType, ExtraProps = object>( | ||
fc: ( | ||
props: Omit<ComponentProps<T>, keyof ExtraProps | keyof AsProp<T>> & AsProp<T> & ExtraProps, | ||
ref: RefOfType<T> | ||
) => ReactElement | ||
props: AsInProps<DefaultType, ExtraProps>, | ||
ref: RefOfType<DefaultType> | ||
) => ReactElement | null | ||
) => | ||
forwardRef(fc) as unknown as <E extends ElementType = T>( | ||
props: Omit<ComponentProps<E>, keyof ExtraProps | keyof AsProp<E>> & AsProp<E> & ExtraProps | ||
) => ReactElement; | ||
forwardRef(fc) as unknown as <T extends ElementType = DefaultType>( | ||
props: AsOutProps<T, ExtraProps> | ||
) => ReturnType<typeof fc>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters