Skip to content

Commit

Permalink
feat: add base typescript declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
finkef committed Oct 26, 2021
1 parent 9a6a0d2 commit b51325c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "Babel macro for writing tailwind styles in React Native (+Web)",
"main": "lib/commonjs",
"module": "lib/module",
"types": "lib/typescript/index.d.ts",
"react-native": "src",
"types": "types.d.ts",
"source": "src",
"exports": {
"./exports": "./lib/commonjs/exports.js",
Expand Down
22 changes: 22 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { flush } from "react-native-media-query"

declare global {
namespace JSX {
interface IntrinsicAttributes {
tw?: string
}
}
}

type TwFunction = (strings: TemplateStringsArray) => any

declare const useTailwindStyles: <
T extends (tw: TwFunction) => { [key: string]: any }
>(
fn: T,
deps?: any[]
) => ReturnType<T>

declare const flush: flush

export { useTailwindStyles, flush }

0 comments on commit b51325c

Please sign in to comment.