Skip to content

Commit 757f4c5

Browse files
committed
Changed ElementType
1 parent 704e257 commit 757f4c5

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

scripts/tests/__snapshots__/all.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ src/08-advanced-patterns/71-as-prop-with-custom-components.problem.tsx(21,20): e
211211
Property 'href' does not exist on type 'IntrinsicAttributes & { as: unknown; }'.
212212
src/08-advanced-patterns/72-as-prop-with-default.problem.tsx(10,11): error TS2322: Type 'Omit<{ as: T; } & ComponentPropsWithoutRef<T>, \\"as\\">' is not assignable to type 'IntrinsicAttributes & LibraryManagedAttributes<T, any>'.
213213
Type 'Omit<{ as: T; } & ComponentPropsWithoutRef<T>, \\"as\\">' is not assignable to type 'LibraryManagedAttributes<T, any>'.
214-
src/08-advanced-patterns/72-as-prop-with-default.problem.tsx(14,2): error TS2741: Property 'as' is missing in type '{ href: string; }' but required in type '{ as: ElementType<any>; }'.
214+
src/08-advanced-patterns/72-as-prop-with-default.problem.tsx(14,2): error TS2741: Property 'as' is missing in type '{ href: string; }' but required in type '{ as: ElementType; }'.
215215
src/09-external-libraries/74-react-hook-form-wrapper.problem.tsx(29,3): error TS2578: Unused '@ts-expect-error' directive.
216216
src/09-external-libraries/74-react-hook-form-wrapper.problem.tsx(42,5): error TS2344: Type 'boolean' does not satisfy the constraint 'true'.
217217
src/09-external-libraries/75-react-select.problem.tsx(10,24): error TS7006: Parameter 'props' implicitly has an 'any' type.

src/08-advanced-patterns/71-as-prop-with-custom-components.solution.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { ComponentPropsWithoutRef, ElementType } from "react";
22
import { Equal, Expect } from "../helpers/type-utils";
33

4-
export const Wrapper = <T extends ElementType<any>>(
4+
export const Wrapper = <T extends ElementType>(
55
props: {
66
as: T;
77
} & ComponentPropsWithoutRef<T>,

src/08-advanced-patterns/72-as-prop-with-default.problem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ComponentPropsWithoutRef, ElementType } from "react";
22
import { Equal, Expect } from "../helpers/type-utils";
33

4-
export const Link = <T extends ElementType<any>>(
4+
export const Link = <T extends ElementType>(
55
props: {
66
as: T;
77
} & ComponentPropsWithoutRef<T>,

src/08-advanced-patterns/72-as-prop-with-default.solution.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ComponentPropsWithoutRef, ElementType } from "react";
22
import { Equal, Expect } from "../helpers/type-utils";
33

4-
export const Link = <T extends ElementType<any> = "a">(
4+
export const Link = <T extends ElementType = "a">(
55
props: {
66
as?: T;
77
} & ComponentPropsWithoutRef<T>,

src/08-advanced-patterns/72.5-as-prop-with-forward-ref.problem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ComponentPropsWithoutRef, ElementType, forwardRef } from "react";
22
import { Equal, Expect } from "../helpers/type-utils";
33

44
export const Link = forwardRef(
5-
<T extends ElementType<any> = "a">(
5+
<T extends ElementType = "a">(
66
props: {
77
as?: T;
88
} & ComponentPropsWithoutRef<T>,

0 commit comments

Comments
 (0)