Skip to content

Commit 2fab9b0

Browse files
committed
Fixed 69
1 parent b460e6a commit 2fab9b0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/08-advanced-patterns/69-as-prop.solution.1.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { Equal, Expect } from "../helpers/type-utils";
22

3-
type AsProps = {
4-
[K in keyof JSX.IntrinsicElements]: {
5-
as: K;
6-
} & JSX.IntrinsicElements[K];
7-
}[keyof JSX.IntrinsicElements];
3+
// Commented out because it makes the whole repo slow to typecheck
4+
// Uncomment to see it working!
5+
6+
// type AsProps = {
7+
// [K in keyof JSX.IntrinsicElements]: {
8+
// as: K;
9+
// } & JSX.IntrinsicElements[K];
10+
// }[keyof JSX.IntrinsicElements];
811

912
export const Wrapper = (props: AsProps) => {
1013
const Comp = props.as;

src/08-advanced-patterns/69-as-prop.solution.2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Equal, Expect } from "../helpers/type-utils";
33
export const Wrapper = <TAs extends keyof JSX.IntrinsicElements>(
44
props: {
55
as: TAs;
6-
} & JSX.IntrinsicElements[TAs],
6+
} & React.ComponentProps<TAs>,
77
) => {
88
const Comp = props.as as string;
99

0 commit comments

Comments
 (0)