-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeclarations.d.ts
More file actions
77 lines (74 loc) · 2.09 KB
/
declarations.d.ts
File metadata and controls
77 lines (74 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { PrismaClient } from "@prisma/client";
import { css as styledComponentsCssHelper } from "styled-components";
import { CSSProp } from "styled-components";
declare global {
/**
* Global helper function to supply styled-componenents CSS-types to a [template literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals).
*
* Not to be confused with from `styled-jsx/css` or `@emotion/react`.
*
* ## Examples:
*
* With prop:
*
* ```tsx
* <div
* css={css`
* color: pink;
* `}
* />
* ```
*
* For standalone CSS:
*
* ```tsx
* const someCSS = css`
* color: pink;
* `;
* ```
*
* The function only supplies types, does nothing, and is strictly not needed, so the following would also work:
*
* ```tsx
* <div
* css={`
* color: pink;
* `}
* />
* ```
*
* For standalone CSS:
*
* ```tsx
* const someCSS = `
* color: pink;
* `;
* ```
*
* ...but with no type safety and a worse developer experience.
*
* ## Motivation:
*
* With a global helper function, we will...
*
* - ...avoid having to import `css` from `styled-components` for every file
* - ...avoid confusion between `css` from `styled-components`, `@emotion/react` and `styled-jsx/css`
*/
// eslint-disable-next-line no-var
// var css: typeof styledComponentsCssHelper | undefined;
namespace JSX {
interface IntrinsicAttributes {
/**
* [styled-components](https://styled-components.com/) `css`-prop implemented with plugins for SWC for Next.js and Babel for Storybook (before SWC support is implemented).
*
* Based on [Emotion's `css`-prop](https://emotion.sh/docs/css-prop), and while the `css`-prop from styled-components isn't documented properly, it is so similar that [Emotion recommends using styled-components' Babel plugin](https://styled-components.com/#installation) for better tooling with their implementation.
*/
css?: CSSProp;
}
}
}
declare module "react" {
interface DOMAttributes<T> {
css?: CSSProp;
}
}