From e79d28e53c5f75f67c31ee745a7da1787ff594be Mon Sep 17 00:00:00 2001 From: Marcus Zanona Date: Wed, 4 May 2022 10:48:59 +0200 Subject: [PATCH 1/2] Add type declaration --- package.json | 1 + src/index.d.ts | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 src/index.d.ts diff --git a/package.json b/package.json index e9d01a6..e464b15 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@tailwindcss/forms", "version": "0.5.1", "main": "src/index.js", + "types": "src/index.d.ts", "license": "MIT", "repository": "https://github.com/tailwindlabs/tailwindcss-forms", "publishConfig": { diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..6856f7f --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,4 @@ +import { TailwindPluginWithOptionsFn } from 'tailwindcss/plugin' + +declare const plugin: TailwindPluginWithOptionsFn<{ strategy?: 'base' | 'class' }> +export default plugin From 1336243b4f616e79b7b929cb7b8a7ffe0a5338d3 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 18 May 2022 15:26:13 +0200 Subject: [PATCH 2/2] update types - This way it doesn't rely on the `@types/tailwindcss` Definetely Typed repo which could cause issues when we release Tailwind CSS 3.1 with our own types. - Use `export = plugin` instead of `export default plugin` so that it is compatible with `module.export` --- src/index.d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index 6856f7f..e54342f 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,4 +1,2 @@ -import { TailwindPluginWithOptionsFn } from 'tailwindcss/plugin' - -declare const plugin: TailwindPluginWithOptionsFn<{ strategy?: 'base' | 'class' }> -export default plugin +declare function plugin(options?: { strategy?: 'base' | 'class' }): Function +export = plugin