Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 05ef34a

Browse files
committed
Rename React.SFC to React.FC
1 parent d870fd9 commit 05ef34a

File tree

12 files changed

+23
-18
lines changed

12 files changed

+23
-18
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"@types/lodash": "^4.14.109",
5959
"@types/node": "^12.7.5",
6060
"@types/prettier": "^1.18.2",
61-
"@types/react": "^16.3.14",
61+
"@types/react": "^16.9.11",
6262
"dedent": "^0.7.0",
6363
"husky": "^3.0.5",
6464
"jest": "^24.9.0",

src/transforms/react-stateless-function-make-props-transform.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type Factory = ts.TransformerFactory<ts.SourceFile>;
2525
* message: string;
2626
* }
2727
*
28-
* const Hello: React.SFC<HelloProps> = ({ message }) => {
28+
* const Hello: React.FC<HelloProps> = ({ message }) => {
2929
* return <div>hello {message}</div>
3030
* }
3131
*
@@ -83,7 +83,7 @@ function visitReactStatelessComponent(
8383
const propTypeDeclaration = ts.createTypeAliasDeclaration([], [], propTypeName, [], propType);
8484
const propTypeRef = ts.createTypeReferenceNode(propTypeName, []);
8585

86-
let componentType = ts.createTypeReferenceNode(ts.createQualifiedName(ts.createIdentifier('React'), 'SFC'), [
86+
let componentType = ts.createTypeReferenceNode(ts.createQualifiedName(ts.createIdentifier('React'), 'FC'), [
8787
shouldMakePropTypeDeclaration ? propTypeRef : propType,
8888
]);
8989

test/collapse-intersection-interfaces-transform/repeated/output.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
type A = {
22
foo: string,
33
};
4-
54
type B = {
65
foo: string | number,
76
bar: number,
87
};
9-
108
type C = {
119
foo: string | number,
1210
bar: number,

test/end-to-end/multiple-components/output.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
type HelloProps = {
22
message?: string,
33
};
4-
const Hello: React.SFC<HelloProps> = ({ message }) => {
4+
const Hello: React.FC<HelloProps> = ({ message }) => {
55
return <div>hello {message}</div>;
66
};
77
type HeyProps = {
88
message?: string,
99
};
10-
const Hey: React.SFC<HeyProps> = ({ name }) => {
10+
const Hey: React.FC<HeyProps> = ({ name }) => {
1111
return <div>hey, {name}</div>;
1212
};
1313
type MyComponentState = {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
type HelloProps = {
22
message?: string,
33
};
4-
const Hello: React.SFC<HelloProps> = ({ message }) => {
4+
const Hello: React.FC<HelloProps> = ({ message }) => {
55
return <div>hello {message}</div>;
66
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
type HelloProps = {
22
message?: string,
33
};
4-
export const Hello: React.SFC<HelloProps> = ({ message }) => {
4+
export const Hello: React.FC<HelloProps> = ({ message }) => {
55
return <div>hello {message}</div>;
66
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Hello: React.SFC<{}> = () => {
1+
const Hello: React.FC<{}> = () => {
22
return <div />;
33
};
44
Hello.propTypes = {};

test/react-stateless-function-make-props-transform/multiple-components/output.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
type HelloProps = {
22
message?: string,
33
};
4-
const Hello: React.SFC<HelloProps> = ({ message }) => {
4+
const Hello: React.FC<HelloProps> = ({ message }) => {
55
return <div>hello {message}</div>;
66
};
77
type HeyProps = {
88
name: string,
99
};
10-
const Hey: React.SFC<HeyProps> = ({ name }) => {
10+
const Hey: React.FC<HeyProps> = ({ name }) => {
1111
return <div>hey, {name}</div>;
1212
};
1313
Hey.propTypes = {

test/react-stateless-function-make-props-transform/stateless-arrow-function/output.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
type HelloProps = {
22
message?: string,
33
};
4-
const Hello: React.SFC<HelloProps> = ({ message }) => {
4+
const Hello: React.FC<HelloProps> = ({ message }) => {
55
return <div>hello {message}</div>;
66
};
77
Hello.propTypes = {

test/react-stateless-function-make-props-transform/stateless-function-many-props/output.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type MyComponentProps = {
3939
fontSize: number,
4040
},
4141
};
42-
const MyComponent: React.SFC<MyComponentProps> = () => {
42+
const MyComponent: React.FC<MyComponentProps> = () => {
4343
return <div />;
4444
};
4545
MyComponent.propTypes = {

0 commit comments

Comments
 (0)