diff --git a/.npmrc b/.npmrc index 1dab4ed4..65e1263c 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ +package-lock=false save-exact = true diff --git a/package.json b/package.json index 76f0cf18..4434d72b 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "webpack.js", "license.md" ], + "typings": "./typings/index.d.ts", "scripts": { "build": "babel src --out-dir dist", "test": "ava", diff --git a/readme.md b/readme.md index 7a67fc5a..44b5a41a 100644 --- a/readme.md +++ b/readme.md @@ -973,7 +973,7 @@ const Button = ({ children }) => ( } ``` -### Syntax Highlighting [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=blanu.vscode-styled-jsx) +### Syntax Highlighting [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=Divlo.vscode-styled-jsx-syntax) Launch VS Code Quick Open (⌘+P), paste the following command, and press enter. ``` 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 ext install vscode-styled-jsx-stylus ``` -### Autocomplete [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=AndrewRazumovsky.vscode-styled-jsx-languageserver) +### Autocomplete [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=Divlo.vscode-styled-jsx-languageserver) Launch VS Code Quick Open (⌘+P), paste the following command, and press enter. ``` ext install Divlo.vscode-styled-jsx-languageserver diff --git a/typings/css.d.ts b/typings/css.d.ts new file mode 100644 index 00000000..ea8e4855 --- /dev/null +++ b/typings/css.d.ts @@ -0,0 +1,11 @@ +// Definitions by: @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 } +} +export { css } diff --git a/typings/index.d.ts b/typings/index.d.ts new file mode 100644 index 00000000..5175234b --- /dev/null +++ b/typings/index.d.ts @@ -0,0 +1,13 @@ +// Definitions by: @types/styled-jsx + +import 'react' + +export * from './server' +export * from './css' + +declare module 'react' { + interface StyleHTMLAttributes extends HTMLAttributes { + jsx?: boolean + global?: boolean + } +} diff --git a/typings/server.d.ts b/typings/server.d.ts new file mode 100644 index 00000000..35a9e26a --- /dev/null +++ b/typings/server.d.ts @@ -0,0 +1,11 @@ +// Definitions by: @types/styled-jsx + +import { ReactElement } from 'react' + +declare function flushToHTML(opts?: { nonce?: string }): string +declare function flushToReact(opts?: { + nonce?: string +}): Array> + +export { flushToHTML } +export default flushToReact