-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(react-dom): expose only required options for InView
- Loading branch information
Showing
3 changed files
with
37 additions
and
28 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
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,19 +1,25 @@ | ||
import type { CSSProperties, ComponentProps } from 'react' | ||
import { FadeIn } from './FadeIn' | ||
import type { OmitKeyof } from './utility-types' | ||
|
||
const Example1 = ({}: { x: string }) => <></> | ||
const Example2 = () => <></> | ||
|
||
describe('<FadeIn/>', () => { | ||
// eslint-disable-next-line vitest/expect-expect | ||
it('type check', () => { | ||
// @ts-expect-error ts(2322) | ||
;(() => <FadeIn as="div" href="https://example.com"></FadeIn>)() | ||
;(() => <FadeIn as="a" href="https://example.com"></FadeIn>)() | ||
;(() => <FadeIn></FadeIn>)() | ||
;(() => <FadeIn as={Example1} x="string"></FadeIn>)() | ||
;(() => <FadeIn as="div" href="https://example.com" />)() | ||
;(() => <FadeIn as="a" href="https://example.com" />)() | ||
;(() => <FadeIn />)() | ||
;(() => <FadeIn as={Example1} x="string" />)() | ||
// @ts-expect-error ts(2322) | ||
;(() => <FadeIn as={Example2} x="string"></FadeIn>)() | ||
// @ts-expect-error ts(2353) | ||
;(() => <FadeIn style={{ opacity: 1 }}></FadeIn>)() | ||
;(() => <FadeIn as={Example2} x="string" />)() | ||
|
||
expectTypeOf<keyof ComponentProps<typeof FadeIn<typeof Example2>>>().toEqualTypeOf< | ||
'root' | 'rootMargin' | 'threshold' | 'triggerOnce' | 'delay' | 'style' | 'as' | 'duration' | 'timingFunction' | ||
>() | ||
expectTypeOf<ComponentProps<typeof FadeIn<typeof Example2>>['style']>().toEqualTypeOf< | ||
OmitKeyof<CSSProperties, 'opacity' | 'willChange' | 'transition'> | undefined | ||
>() | ||
}) | ||
}) | ||
|
||
const Example1 = ({}: { x: string }) => <></> | ||
const Example2 = () => <></> |
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