atlassian / atlassian/extract-react-types

Props not being extracted when using both memo and forward ref

Open
#201 1 comment 0 reactions 0 assignees View on GitHub
typescript
Dominant language
JavaScript
Stars
188
Forks
31
PR merge metrics
No merged PRs in 30d

Description

Doesn't work:

```ts
import { TextfieldProps } from './types';

const Textfield = forwardRef((props: TextfieldProps, ref) => {
^^^^^^^^^^^^^^^ not extracted
return ;
});

Textfield.displayName = 'Textfield';

export default memo(Textfield);
```

Doesn't work:

```ts
import { TextfieldProps } from './types';

const Textfield = forwardRef((props: TextfieldProps, ref) => {
^^^^^^^^^^^^^^^ not extracted
return ;
});

Textfield.displayName = 'Textfield';

export default memo(Textfield);
```

Works

```ts
import { TextfieldProps } from './types';

const Textfield = forwardRef((props: TextfieldProps, ref) => {
return ;
});

Textfield.displayName = 'Textfield';

export default memo(Textfield);
^^^^^^^^^^^^^^^ extracts, but now missing ref prop in the component types
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.