From 05d1f34156313f537023d43ef57df9bde39b9384 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Thu, 11 Aug 2022 01:50:50 +0200 Subject: [PATCH 1/2] fix: tweak types --- global.d.ts | 13 +++++++++++++ index.d.ts | 11 ++--------- package.json | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 global.d.ts diff --git a/global.d.ts b/global.d.ts new file mode 100644 index 00000000..b58a66d4 --- /dev/null +++ b/global.d.ts @@ -0,0 +1,13 @@ +/// +/// +/// +/// + +import React from 'react' + +declare module 'react' { + interface StyleHTMLAttributes extends HTMLAttributes { + jsx?: boolean + global?: boolean + } +} diff --git a/index.d.ts b/index.d.ts index 3024c42c..344b9d7b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,13 +1,6 @@ -import React from 'react' - -declare module 'react' { - interface StyleHTMLAttributes extends HTMLAttributes { - jsx?: boolean - global?: boolean - } -} - declare module 'styled-jsx' { + import React from 'react' + export type StyledJsxStyleRegistry = { styles(options?: { nonce?: string }): JSX.Element[] flush(): void diff --git a/package.json b/package.json index 6c2f1424..9eac8c7b 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "files": [ "dist", "lib", + "global.d.ts", "index.d.ts", "index.js", "babel.js", From 5b548258a0841240c3c0c072e4c95e819406864c Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Thu, 11 Aug 2022 13:46:52 +0200 Subject: [PATCH 2/2] use import() --- index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 344b9d7b..3d015b8e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,6 +1,4 @@ declare module 'styled-jsx' { - import React from 'react' - export type StyledJsxStyleRegistry = { styles(options?: { nonce?: string }): JSX.Element[] flush(): void @@ -12,7 +10,7 @@ declare module 'styled-jsx' { children, registry }: { - children: JSX.Element | React.ReactNode + children: JSX.Element | import('react').ReactNode registry?: StyledJsxStyleRegistry }): JSX.Element export function createStyleRegistry(): StyledJsxStyleRegistry