Skip to content

Commit

Permalink
Changed ElementType
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Jul 24, 2023
1 parent 704e257 commit 757f4c5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/tests/__snapshots__/all.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ src/08-advanced-patterns/71-as-prop-with-custom-components.problem.tsx(21,20): e
Property 'href' does not exist on type 'IntrinsicAttributes & { as: unknown; }'.
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>'.
Type 'Omit<{ as: T; } & ComponentPropsWithoutRef<T>, \\"as\\">' is not assignable to type 'LibraryManagedAttributes<T, any>'.
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>; }'.
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; }'.
src/09-external-libraries/74-react-hook-form-wrapper.problem.tsx(29,3): error TS2578: Unused '@ts-expect-error' directive.
src/09-external-libraries/74-react-hook-form-wrapper.problem.tsx(42,5): error TS2344: Type 'boolean' does not satisfy the constraint 'true'.
src/09-external-libraries/75-react-select.problem.tsx(10,24): error TS7006: Parameter 'props' implicitly has an 'any' type.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ComponentPropsWithoutRef, ElementType } from "react";
import { Equal, Expect } from "../helpers/type-utils";

export const Wrapper = <T extends ElementType<any>>(
export const Wrapper = <T extends ElementType>(
props: {
as: T;
} & ComponentPropsWithoutRef<T>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentPropsWithoutRef, ElementType } from "react";
import { Equal, Expect } from "../helpers/type-utils";

export const Link = <T extends ElementType<any>>(
export const Link = <T extends ElementType>(
props: {
as: T;
} & ComponentPropsWithoutRef<T>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentPropsWithoutRef, ElementType } from "react";
import { Equal, Expect } from "../helpers/type-utils";

export const Link = <T extends ElementType<any> = "a">(
export const Link = <T extends ElementType = "a">(
props: {
as?: T;
} & ComponentPropsWithoutRef<T>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ComponentPropsWithoutRef, ElementType, forwardRef } from "react";
import { Equal, Expect } from "../helpers/type-utils";

export const Link = forwardRef(
<T extends ElementType<any> = "a">(
<T extends ElementType = "a">(
props: {
as?: T;
} & ComponentPropsWithoutRef<T>,
Expand Down

0 comments on commit 757f4c5

Please sign in to comment.