Skip to content

Commit

Permalink
fix: declare module and fix conflict typing name (#805)
Browse files Browse the repository at this point in the history
* fix: declare module and fix conflict typing name

* update css, marco, style
  • Loading branch information
huozhi committed Aug 9, 2022
1 parent 6e1c5ef commit 22e36bf
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 32 deletions.
21 changes: 13 additions & 8 deletions css.d.ts
@@ -1,11 +1,16 @@
// Definitions by: @types/styled-jsx <https://www.npmjs.com/package/@types/styled-jsx>

declare function css(chunks: TemplateStringsArray, ...args: any[]): JSX.Element
declare namespace css {
function global(chunks: TemplateStringsArray, ...args: any[]): JSX.Element
function resolve(
chunks: TemplateStringsArray,
...args: any[]
): { className: string; styles: JSX.Element }
declare module 'styled-jsx/css' {
function css(chunks: TemplateStringsArray, ...args: any[]): JSX.Element
namespace css {
export function global(
chunks: TemplateStringsArray,
...args: any[]
): JSX.Element
export function resolve(
chunks: TemplateStringsArray,
...args: any[]
): { className: string; styles: JSX.Element }
}
export = css
}
export = css
30 changes: 16 additions & 14 deletions index.d.ts
Expand Up @@ -7,18 +7,20 @@ declare module 'react' {
}
}

export type StyleRegistry = {
styles(options?: { nonce?: string }): JSX.Element[]
flush(): void
add(props: any): void
remove(props: any): void
declare module 'styled-jsx' {
export type StyledJsxStyleRegistry = {
styles(options?: { nonce?: string }): JSX.Element[]
flush(): void
add(props: any): void
remove(props: any): void
}
export function useStyleRegistry(): StyledJsxStyleRegistry
export function StyleRegistry({
children,
registry
}: {
children: JSX.Element | React.ReactNode
registry?: StyledJsxStyleRegistry
}): JSX.Element
export function createStyleRegistry(): StyledJsxStyleRegistry
}
export function useStyleRegistry(): StyleRegistry
export function StyleRegistry({
children,
registry
}: {
children: JSX.Element | React.ReactNode
registry?: StyleRegistry
}): JSX.Element
export function createStyleRegistry(): StyleRegistry
20 changes: 11 additions & 9 deletions macro.d.ts
@@ -1,11 +1,13 @@
declare namespace css {
function resolve(
chunks: TemplateStringsArray,
...args: any[]
): {
className: string
styles: JSX.Element
declare module 'styled-jsx/marco' {
namespace marco {
function resolve(
chunks: TemplateStringsArray,
...args: any[]
): {
className: string
styles: JSX.Element
}
}
}

export = css
export = marco
}
4 changes: 3 additions & 1 deletion style.d.ts
@@ -1 +1,3 @@
export default function JSXStyle(props: any): null
declare module 'styled-jsx/style' {
export default function JSXStyle(props: any): null
}

0 comments on commit 22e36bf

Please sign in to comment.