Skip to content

Commit

Permalink
fix: Correct context for declaration files
Browse files Browse the repository at this point in the history
Fixes "Cannot find module 'styled-jsx' or its corresponding type declarations"
  • Loading branch information
eps1lon committed May 24, 2024
1 parent 4c8cafc commit aa684d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion css.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { JSX } from "react";
// Definitions by: @types/styled-jsx <https://www.npmjs.com/package/@types/styled-jsx>

declare module 'styled-jsx/css' {
import type { JSX } from "react";

function css(chunks: TemplateStringsArray, ...args: any[]): JSX.Element
namespace css {
export function global(
Expand Down
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { JSX } from "react";
/// <reference types="./css" />
/// <reference types="./macro" />
/// <reference types="./style" />
/// <reference types="./global" />

declare module 'styled-jsx' {
import type { JSX } from "react";

export type StyledJsxStyleRegistry = {
styles(options?: { nonce?: string }): JSX.Element[]
flush(): void
Expand Down
3 changes: 2 additions & 1 deletion macro.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { JSX } from "react";
declare module 'styled-jsx/macro' {
import type { JSX } from "react";

namespace macro {
function resolve(
chunks: TemplateStringsArray,
Expand Down

0 comments on commit aa684d5

Please sign in to comment.