Commit 3bf5323
committed
Reduce types before checking if they are
When types are checked if they are `never` by their `TypeFlags`, they
must first be reduced, because intersection types of object-like types
which reduce to `never` don't have `TypeFlags.Never`. See microsoft#36696 for
details.
When a function is declared to return such type and it doesn't contain
any return statement or it only contains return statements without
expression, the error messages are incorrect as the checker sees its
return type as non-`never`.
This commit takes into account that intersection types potentially
reduces to `never` and improves error messages.never
1 parent efe5e3d commit 3bf5323Copy full SHA for 3bf5323
1 file changed
+6-3Lines changed: 6 additions & 3 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- src/compiler
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+6-3Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
32140 | 32140 | |
32141 | 32141 | |
32142 | 32142 | |
32143 | | - |
| 32143 | + |
| 32144 | + |
32144 | 32145 | |
32145 | 32146 | |
32146 | 32147 | |
| ||
32157 | 32158 | |
32158 | 32159 | |
32159 | 32160 | |
32160 | | - |
| 32161 | + |
| 32162 | + |
| 32163 | + |
32161 | 32164 | |
32162 | 32165 | |
32163 | 32166 | |
| ||
38219 | 38222 | |
38220 | 38223 | |
38221 | 38224 | |
38222 | | - |
| 38225 | + |
38223 | 38226 | |
38224 | 38227 | |
38225 | 38228 | |
|
0 commit comments