Skip to content

Commit

Permalink
test Array generic
Browse files Browse the repository at this point in the history
  • Loading branch information
henryqdineen committed Dec 11, 2024
1 parent 5080e22 commit 8c90389
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions transforms/__tests__/deprecated-react-child.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,34 @@ test("as type parameter", () => {
`);
});

test("array syntax", () => {
test("array type syntax", () => {
expect(
applyTransform(`
import { ReactChild } from 'react';
interface Props {
import { ReactChild } from 'react';
interface Props {
children?: ReactChild[];
}
`),
`),
).toMatchInlineSnapshot(`
"import { ReactElement } from 'react';
interface Props {
children?: (ReactElement | number | string)[];
}"
children?: (ReactElement | number | string)[];
}"
`);
});

test("Array generic", () => {
expect(
applyTransform(`
import { ReactChild } from 'react';
interface Props {
children?: Array<ReactChild>;
}
`),
).toMatchInlineSnapshot(`
"import { ReactElement } from 'react';
interface Props {
children?: Array<ReactElement | number | string>;
}"
`);
});

0 comments on commit 8c90389

Please sign in to comment.