From 5a093bb38af2a3fa4f5831a59ca4bcd9823bb81a Mon Sep 17 00:00:00 2001 From: Roma Y Date: Wed, 30 Oct 2019 12:12:58 +0500 Subject: [PATCH 1/2] generic for props --- package.json | 2 +- rollup.config.js | 2 +- src/{index.tsx => index.ts} | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename src/{index.tsx => index.ts} (96%) diff --git a/package.json b/package.json index df64104..31cbe28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webcomponents-in-react", - "version": "1.0.1", + "version": "1.0.2", "description": "Use web components in React as if they were regular React components. Zero dependencies adapter.", "main": "dist/index.js", "module": "dist/index.esm.js", diff --git a/rollup.config.js b/rollup.config.js index 9da046c..1d50015 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -2,7 +2,7 @@ import typescript from "rollup-plugin-typescript2"; import pkg from "./package.json"; export default { - input: "src/index.tsx", + input: "src/index.ts", output: [ { file: pkg.main, diff --git a/src/index.tsx b/src/index.ts similarity index 96% rename from src/index.tsx rename to src/index.ts index a57c23e..c32da1e 100644 --- a/src/index.tsx +++ b/src/index.ts @@ -9,11 +9,11 @@ import { import { OverrideProps, EventListenerMap } from "./interfaces"; import { DEFAULT_EVENT_PREFIX } from "./constants"; -export const adapt = ( +export const adapt = ( componentSelector: string, overrideProps?: OverrideProps ) => { - return (props: any) => { + return (props: T & EventListenerMap) => { const webComponentRef = useRef(null); useEffect(() => { From 06eae648bf4142ce9e42e2804a984c6bf793a011 Mon Sep 17 00:00:00 2001 From: Roma Y Date: Wed, 30 Oct 2019 16:14:01 +0500 Subject: [PATCH 2/2] default type --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index c32da1e..bc01a97 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,7 @@ import { import { OverrideProps, EventListenerMap } from "./interfaces"; import { DEFAULT_EVENT_PREFIX } from "./constants"; -export const adapt = ( +export const adapt = ( componentSelector: string, overrideProps?: OverrideProps ) => {