Skip to content

Commit e830b59

Browse files
committed
Ping whenever ts(2322) is solved
Related (I think): microsoft/TypeScript#28884
1 parent 8646691 commit e830b59

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/react/src/__tests__/__fixtures__/typings.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// tslint:disable no-unused-expression max-classes-per-file
22

33
import * as React from 'react';
4-
import { applyClassName, GlitzProvider, styled, StyledElementProps } from '../..';
4+
import { applyClassName, GlitzProvider, styled, StyledElementProps, StyledComponent } from '../..';
55
import { GlitzClient, GlitzServer } from '../../../../core/src';
66

77
const client = new GlitzClient();
@@ -243,3 +243,13 @@ const StyledComponentWithInheritedRef = styled(styled.button({}));
243243

244244
const StyledComponentFunctionWithoutRef = styled(({}: { ref?: React.Ref<HTMLButtonElement> }) => <styled.Button />);
245245
<StyledComponentFunctionWithoutRef css={{}} ref={React.createRef()} />;
246+
247+
export function createStyledComponent<TProps>(Component: StyledComponent<TProps>) {
248+
// Just to ping whenever this is fixed
249+
// Related (I think): https://github.com/microsoft/TypeScript/issues/28884
250+
// @ts-expect-error
251+
({ x, ...restProps }: TProps & { x: string }) => <Component {...restProps} />;
252+
// @ts-expect-error
253+
styled(({ x, ...restProps }: TProps & { x: string }) => <Component {...restProps} />);
254+
styled(({ x, ...restProps }: TProps & { x: string }) => <Component {...((restProps as unknown) as TProps)} />);
255+
}

0 commit comments

Comments
 (0)