Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use any for JSX fragments #973

Merged
merged 2 commits into from
Apr 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/stc_ts_file_analyzer/src/analyzer/expr/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ impl Analyzer<'_, '_> {
fn validate(&mut self, e: &RJSXFragment, type_ann: Option<&Type>) -> VResult<Type> {
let children = e.children.validate_with_default(self)?;

self.get_jsx_intrinsic_element(e.span, &"Fragment".into())
// See https://github.com/microsoft/TypeScript/issues/50429
// The TypeScript does not specify the validation rule for JSXFragment.
Ok(Type::any(e.span, Default::default()))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
42
]
},
"extra_errors": {
"TS2339": 5
},
"extra_error_lines": {
"TS2339": [
24,
25,
26,
39,
42
]
}
"extra_errors": {},
"extra_error_lines": {}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Stats {
required_error: 1,
matched_error: 0,
extra_error: 5,
extra_error: 0,
panic: 0,
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Stats {
required_error: 0,
matched_error: 0,
extra_error: 1,
extra_error: 0,
panic: 0,
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"required_errors": {
"TS2322": 6,
"TS2540": 2,
"TS2542": 1,
"TS2540": 1,
"TS2339": 1,
"TS2403": 1
},
"required_error_lines": {
Expand All @@ -14,11 +15,15 @@
109,
111
],
"TS2540": [
137,
139
],
"TS2542": [
138
],
"TS2540": [
139
"TS2339": [
140
],
"TS2403": [
266
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Stats {
required_error: 9,
matched_error: 11,
required_error: 11,
matched_error: 9,
extra_error: 3,
panic: 0,
}
6 changes: 3 additions & 3 deletions crates/stc_ts_type_checker/tests/tsc-stats.rust-debug
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Stats {
required_error: 3714,
matched_error: 6320,
extra_error: 757,
required_error: 3716,
matched_error: 6318,
extra_error: 751,
panic: 106,
}