From f9e9ef9fff828f9f182b86332cc8b9d1c6597f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Wed, 4 Dec 2024 12:32:53 +0100 Subject: [PATCH] rewrite tests to stop relying on implementation detail --- packages/react/types/tests.tsx | 62 ++++++++++++++-------------------- 1 file changed, 25 insertions(+), 37 deletions(-) diff --git a/packages/react/types/tests.tsx b/packages/react/types/tests.tsx index 06f8785c74..de9ca8543e 100644 --- a/packages/react/types/tests.tsx +++ b/packages/react/types/tests.tsx @@ -8,7 +8,6 @@ import { keyframes, withEmotionCache } from '@emotion/react' -import { JSX as EmotionJSX } from '@emotion/react/jsx-runtime' import { CSSInterpolation } from '@emotion/serialize' declare module '@emotion/react' { @@ -225,44 +224,33 @@ const anim1 = keyframes` // Tests for WithConditionalCSSProp { - // $ExpectType Interpolation - type _HasCssPropAsIntended3 = EmotionJSX.LibraryManagedAttributes< - {}, - { - className?: string - } - >['css'] + const WithOptionalClassName = (props: { className?: string }) => null + ; + ; - // $ExpectType Interpolation - type _HasCssPropAsIntended4 = EmotionJSX.LibraryManagedAttributes< - {}, - { - className: string - } - >['css'] + const WithRequiredClassName = (props: { className: string }) => null + // $ExpectError + ; + // $ExpectError + ; - // $ExpectType Interpolation - type _HasCssPropAsIntended5 = EmotionJSX.LibraryManagedAttributes< - {}, - { - className?: unknown - } - >['css'] + const WithOptionalUnknownClassName = (props: { className?: unknown }) => null + ; + ; - // $ExpectType Interpolation - type _HasCssPropAsIntended6 = EmotionJSX.LibraryManagedAttributes< - {}, - { - className?: string | Array - } - >['css'] + const WithOptionalUnionClassName = (props: { + className?: string | Array + }) => null + ; + ; + + const WithNoClassName = (props: { foo: string }) => null + ; + // $ExpectError + ; - // $ExpectType false - type _NoCssPropAsIntended1 = - 'css' extends keyof EmotionJSX.LibraryManagedAttributes< - {}, - { className?: undefined } - > - ? true - : false + const WithOptionalUndefinedClassName = (props: { foo: string }) => null + ; + // $ExpectError + ; }