-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flow] Test showing duplicated errors on indexed object subtyping
Summary: I'd like to make an improvement to these errors so that we only emit the value-side errors if the key check already passes. Showing the bad error behavior with a test in this diff. The additional errors provide very little value. Changelog: [internal] Reviewed By: SamChou19815 Differential Revision: D69023898 fbshipit-source-id: f4a5044c12846ae3c14e6d8a26d2343325146d49
- Loading branch information
1 parent
f2dcd93
commit 52b04be
Showing
2 changed files
with
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,39 @@ | ||
Found 0 errors | ||
Error ---------------------------------------------------------------------------------------------------- test.js:15:23 | ||
|
||
Cannot assign object literal to `error1` because string `foo` [1] is incompatible with string prefixed with `data-` [2] | ||
in the indexer property's key. [incompatible-type] | ||
|
||
test.js:15:23 | ||
15| const error1: Props = {foo: 3}; | ||
^^^^^^^^ [1] | ||
|
||
References: | ||
test.js:11:4 | ||
11| [StringPrefix<'data-'>]: string | void, | ||
^^^^^^^^^^^^^^^^^^^^^ [2] | ||
|
||
|
||
Error ---------------------------------------------------------------------------------------------------- test.js:15:29 | ||
|
||
Cannot assign object literal to `error1` because in property `foo`: [incompatible-type] | ||
- Either number [1] is incompatible with string [2]. | ||
- Or number [1] is incompatible with undefined [3]. | ||
|
||
test.js:15:29 | ||
15| const error1: Props = {foo: 3}; | ||
^ [1] | ||
|
||
References: | ||
test.js:11:28 | ||
11| [StringPrefix<'data-'>]: string | void, | ||
^^^^^^ [2] | ||
test.js:11:37 | ||
11| [StringPrefix<'data-'>]: string | void, | ||
^^^^ [3] | ||
|
||
|
||
|
||
Found 2 errors | ||
|
||
Only showing the most relevant union/intersection branches. | ||
To see all branches, re-run Flow with --show-all-branches |
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