Skip to content

Commit

Permalink
Fix the test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ENvironmentSet committed Aug 3, 2024
1 parent 1de1d20 commit 50eee88
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions packages/react/types/tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
css,
jsx,
keyframes,
withEmotionCache
withEmotionCache,
Interpolation,
Theme
} from '@emotion/react'
import { JSX as EmotionJSX } from '@emotion/react/jsx-runtime'
import { CSSInterpolation } from '@emotion/serialize'
Expand Down Expand Up @@ -240,11 +242,17 @@ const anim1 = keyframes`
}
>['css']

// $ExpectType { foo: number; className: string; css?: Interpolation<Theme> } | { foo: string }
type _HasCssPropAsIntended7 = EmotionJSX.LibraryManagedAttributes<
{},
{ foo: number; className: string } | { foo: string }
>
/*
Additional brackets here prevent type reference('EmotionJSX.LibraryManagedAttributes<...>') from being resolved to type alias name('_HasCssPropAsIntended7').
Without them, dtslint will compare the expected type to the type name.
*/
type _HasCssPropAsIntended7 = [
// $ExpectType { foo: boolean; } | ({ css?: Interpolation<Theme>; } & { foo: number; className: string; })
EmotionJSX.LibraryManagedAttributes<
{},
{ foo: number; className: string } | { foo: boolean }
>
]

// $ExpectType false
type _NoCssPropAsIntended1 =
Expand Down

0 comments on commit 50eee88

Please sign in to comment.