This repository has been archived by the owner on Sep 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep other static class members, such as defaultProps (#36)
* Add test for defaultProps * Check if the name == "propTypes", not != " propTypes" * More ways of getting the class member name (hacky) * Check if we're an identifier; if we are we can just always use name.escapedText * Use ts.isIdentifier helper function instead of direct comparison on .kind
- Loading branch information
Showing
3 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
test/react-remove-static-prop-types-member-transform/other-static-members/input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class SomeComponent extends React.Component<{ | ||
foo: number; | ||
}, { | ||
bar: string; | ||
}> { | ||
static propTypes = { foo: React.PropTypes.string }; | ||
static defaultProps = { foo: 'bar' }; | ||
} |
10 changes: 10 additions & 0 deletions
10
test/react-remove-static-prop-types-member-transform/other-static-members/output.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class SomeComponent extends React.Component< | ||
{ | ||
foo: number, | ||
}, | ||
{ | ||
bar: string, | ||
}, | ||
> { | ||
static defaultProps = { foo: 'bar' }; | ||
} |