Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the emit when jsx attribute expression is empty
Fixes #12994
- Loading branch information
1 parent
32cec58
commit f412e10
Showing
4 changed files
with
59 additions
and
0 deletions.
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
33 changes: 33 additions & 0 deletions
33
tests/baselines/reference/jsxAttributeWithoutExpressionReact.errors.txt
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 @@ | ||
tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(3,2): error TS2304: Cannot find name 'View'. | ||
tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(4,6): error TS2304: Cannot find name 'ListView'. | ||
tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(5,10): error TS2304: Cannot find name 'RefreshControl'. | ||
tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(5,35): error TS17000: JSX attributes must only be assigned a non-empty 'expression'. | ||
tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(6,44): error TS17000: JSX attributes must only be assigned a non-empty 'expression'. | ||
tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(7,7): error TS2304: Cannot find name 'ListView'. | ||
tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(8,3): error TS2304: Cannot find name 'View'. | ||
|
||
|
||
==== tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx (7 errors) ==== | ||
|
||
declare var React: any; | ||
<View> | ||
~~~~ | ||
!!! error TS2304: Cannot find name 'View'. | ||
<ListView refreshControl={ | ||
~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'ListView'. | ||
<RefreshControl onRefresh={} refreshing={} /> | ||
~~~~~~~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'RefreshControl'. | ||
~~ | ||
!!! error TS17000: JSX attributes must only be assigned a non-empty 'expression'. | ||
} dataSource={this.state.ds} renderRow={}> | ||
~~ | ||
!!! error TS17000: JSX attributes must only be assigned a non-empty 'expression'. | ||
</ListView> | ||
~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'ListView'. | ||
</View> | ||
~~~~ | ||
!!! error TS2304: Cannot find name 'View'. | ||
|
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/jsxAttributeWithoutExpressionReact.js
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,14 @@ | ||
//// [jsxAttributeWithoutExpressionReact.tsx] | ||
|
||
declare var React: any; | ||
<View> | ||
<ListView refreshControl={ | ||
<RefreshControl onRefresh={} refreshing={} /> | ||
} dataSource={this.state.ds} renderRow={}> | ||
</ListView> | ||
</View> | ||
|
||
|
||
//// [jsxAttributeWithoutExpressionReact.js] | ||
React.createElement(View, null, | ||
React.createElement(ListView, { refreshControl: React.createElement(RefreshControl, { onRefresh: true, refreshing: true }), dataSource: this.state.ds, renderRow: true })); |
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,9 @@ | ||
//@jsx: react | ||
|
||
declare var React: any; | ||
<View> | ||
<ListView refreshControl={ | ||
<RefreshControl onRefresh={} refreshing={} /> | ||
} dataSource={this.state.ds} renderRow={}> | ||
</ListView> | ||
</View> |