-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #338 from michelengelen/feature/parse-default-valu…
…esinimmediately-destructured-props parse default values in immediately destructured props
- Loading branch information
Showing
5 changed files
with
193 additions
and
4 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/__tests__/data/FunctionalComponentWithDesctructuredProps.constants.ts
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,13 @@ | ||
const PROPERTY1_DEFAULT = 'hello'; | ||
const PROPERTY2_DEFAULT = 'goodbye'; | ||
const PROPERTY3_DEFAULT = 10; | ||
const PROPERTY4_DEFAULT = 'this is a string'; | ||
const PROPERTY5_DEFAULT = true; | ||
|
||
export { | ||
PROPERTY1_DEFAULT, | ||
PROPERTY2_DEFAULT, | ||
PROPERTY3_DEFAULT, | ||
PROPERTY4_DEFAULT, | ||
PROPERTY5_DEFAULT | ||
}; |
33 changes: 33 additions & 0 deletions
33
src/__tests__/data/FunctionalComponentWithDesctructuredProps.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,33 @@ | ||
import * as React from 'react'; | ||
|
||
const PROPERTY1_DEFAULT = 'hello'; | ||
const PROPERTY2_DEFAULT = 'goodbye'; | ||
const PROPERTY3_DEFAULT = 10; | ||
const PROPERTY4_DEFAULT = 'this is a string'; | ||
const PROPERTY5_DEFAULT = true; | ||
|
||
type Property1Type = 'hello' | 'world'; | ||
|
||
type Props = { | ||
/** prop1 description */ | ||
prop1?: Property1Type; | ||
/** prop2 description */ | ||
prop2?: 'goodbye' | 'farewell'; | ||
/** prop3 description */ | ||
prop3?: number; | ||
/** prop4 description */ | ||
prop4?: string; | ||
/** prop5 description */ | ||
prop5?: boolean; | ||
}; | ||
|
||
/** FunctionalComponentWithDesctructuredProps description */ | ||
const FunctionalComponentWithDesctructuredProps: React.FC<Props> = ({ | ||
prop1 = PROPERTY1_DEFAULT, | ||
prop2 = PROPERTY2_DEFAULT, | ||
prop3 = PROPERTY3_DEFAULT, | ||
prop4 = PROPERTY4_DEFAULT, | ||
prop5 = PROPERTY5_DEFAULT | ||
}) => <div />; | ||
|
||
export default FunctionalComponentWithDesctructuredProps; |
35 changes: 35 additions & 0 deletions
35
src/__tests__/data/FunctionalComponentWithDesctructuredPropsAndImportedConstants.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,35 @@ | ||
import * as React from 'react'; | ||
|
||
import { | ||
PROPERTY1_DEFAULT, | ||
PROPERTY2_DEFAULT, | ||
PROPERTY3_DEFAULT, | ||
PROPERTY4_DEFAULT, | ||
PROPERTY5_DEFAULT | ||
} from './FunctionalComponentWithDesctructuredProps.constants'; | ||
|
||
type Property1Type = 'hello' | 'world'; | ||
|
||
type Props = { | ||
/** prop1 description */ | ||
prop1?: Property1Type; | ||
/** prop2 description */ | ||
prop2?: 'goodbye' | 'farewell'; | ||
/** prop3 description */ | ||
prop3?: number; | ||
/** prop4 description */ | ||
prop4?: string; | ||
/** prop5 description */ | ||
prop5?: boolean; | ||
}; | ||
|
||
/** FunctionalComponentWithDesctructuredPropsAndImportedConstants description */ | ||
const FunctionalComponentWithDesctructuredPropsAndImportedConstants: React.FC<Props> = ({ | ||
prop1 = PROPERTY1_DEFAULT, | ||
prop2 = PROPERTY2_DEFAULT, | ||
prop3 = PROPERTY3_DEFAULT, | ||
prop4 = PROPERTY4_DEFAULT, | ||
prop5 = PROPERTY5_DEFAULT | ||
}) => <div />; | ||
|
||
export default FunctionalComponentWithDesctructuredPropsAndImportedConstants; |
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
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