Skip to content

Commit 4dd5c13

Browse files
authored
feat: add TypeScript typings builtin (#692)
1 parent eb65f35 commit 4dd5c13

File tree

6 files changed

+39
-2
lines changed

6 files changed

+39
-2
lines changed

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
package-lock=false
12
save-exact = true

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"webpack.js",
1717
"license.md"
1818
],
19+
"typings": "./typings/index.d.ts",
1920
"scripts": {
2021
"build": "babel src --out-dir dist",
2122
"test": "ava",

readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ const Button = ({ children }) => (
973973
}
974974
```
975975

976-
### Syntax Highlighting [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=blanu.vscode-styled-jsx)
976+
### Syntax Highlighting [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=Divlo.vscode-styled-jsx-syntax)
977977
Launch VS Code Quick Open (⌘+P), paste the following command, and press enter.
978978
```
979979
ext install Divlo.vscode-styled-jsx-syntax
@@ -984,7 +984,7 @@ If you use Stylus instead of plain CSS, install [vscode-styled-jsx-stylus](https
984984
ext install vscode-styled-jsx-stylus
985985
```
986986

987-
### Autocomplete [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=AndrewRazumovsky.vscode-styled-jsx-languageserver)
987+
### Autocomplete [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=Divlo.vscode-styled-jsx-languageserver)
988988
Launch VS Code Quick Open (⌘+P), paste the following command, and press enter.
989989
```
990990
ext install Divlo.vscode-styled-jsx-languageserver

typings/css.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Definitions by: @types/styled-jsx <https://www.npmjs.com/package/@types/styled-jsx>
2+
3+
declare function css(chunks: TemplateStringsArray, ...args: any[]): JSX.Element
4+
declare namespace css {
5+
function global(chunks: TemplateStringsArray, ...args: any[]): JSX.Element
6+
function resolve(
7+
chunks: TemplateStringsArray,
8+
...args: any[]
9+
): { className: string; styles: JSX.Element }
10+
}
11+
export { css }

typings/index.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Definitions by: @types/styled-jsx <https://www.npmjs.com/package/@types/styled-jsx>
2+
3+
import 'react'
4+
5+
export * from './server'
6+
export * from './css'
7+
8+
declare module 'react' {
9+
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
10+
jsx?: boolean
11+
global?: boolean
12+
}
13+
}

typings/server.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Definitions by: @types/styled-jsx <https://www.npmjs.com/package/@types/styled-jsx>
2+
3+
import { ReactElement } from 'react'
4+
5+
declare function flushToHTML(opts?: { nonce?: string }): string
6+
declare function flushToReact<T>(opts?: {
7+
nonce?: string
8+
}): Array<ReactElement<T>>
9+
10+
export { flushToHTML }
11+
export default flushToReact

0 commit comments

Comments
 (0)