From 5c96e73acae3af88132d74abe876f15ea2b411ac Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Sat, 12 Dec 2020 14:34:03 -0600 Subject: [PATCH 1/4] fix: TS types on Router children components --- index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 8d3cb4c5..5280a765 100644 --- a/index.d.ts +++ b/index.d.ts @@ -65,7 +65,9 @@ export function Route( export function Link(props: {activeClassName?: string} & preact.JSX.HTMLAttributes): preact.VNode; declare module 'preact' { - export interface Attributes extends RoutableProps {} + namespace JSX { + interface IntrinsicAttributes extends RoutableProps {} + } } export default Router; \ No newline at end of file From be819dad2e7d55733c2117de2a27c3161c8dccc3 Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Sat, 12 Dec 2020 21:34:35 -0600 Subject: [PATCH 2/4] fix: Correcting typing error that missed non-components --- index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/index.d.ts b/index.d.ts index 5280a765..67c5deb1 100644 --- a/index.d.ts +++ b/index.d.ts @@ -68,6 +68,7 @@ declare module 'preact' { namespace JSX { interface IntrinsicAttributes extends RoutableProps {} } + interface Attributes extends RoutableProps {} } export default Router; \ No newline at end of file From f2417af5b173096de997029a5dd7fb13e8b8f759 Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Sat, 12 Dec 2020 21:47:19 -0600 Subject: [PATCH 3/4] test: Adding test to check new type correction --- test/router.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/router.tsx b/test/router.tsx index fceeea52..b67af6b9 100644 --- a/test/router.tsx +++ b/test/router.tsx @@ -11,12 +11,17 @@ const SomeFunctionalComponent: FunctionalComponent<{}> = ({}) => { return
; }; +function FunctionalComponentWithoutAnnotation() { + return
; +} + function RouterWithComponents() { return (
+
From 528dcf0afb7407d0ab5d45f17b30a2d41a0d5658 Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Sat, 12 Dec 2020 22:29:02 -0600 Subject: [PATCH 4/4] chore: Bumping TS to resolve issue --- package-lock.json | 12 +++++++++--- package.json | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8649f537..b3bec212 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6800,6 +6800,12 @@ "@types/node": "*", "acorn": "^7.1.0" } + }, + "typescript": { + "version": "3.9.7", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", + "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", + "dev": true } } }, @@ -11141,9 +11147,9 @@ "dev": true }, "typescript": { - "version": "3.7.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", - "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz", + "integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==", "dev": true }, "ultron": { diff --git a/package.json b/package.json index 0a001da9..268b0817 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "rimraf": "^2.5.1", "sinon": "^7.1.0", "sinon-chai": "^2.8.0", - "typescript": "^3.4.4", + "typescript": "4.0.5", "webpack": "^4.42.0" } }