-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow
expectError
directives to detect parameter count mismatches (#…
…102)
- Loading branch information
1 parent
27ccc49
commit 8fe3924
Showing
8 changed files
with
34 additions
and
2 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
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
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,3 +1,11 @@ | ||
module.exports.default = (foo, bar) => foo + bar; | ||
|
||
module.exports.two = (foo, bar, baz) => { | ||
if (foo!= null && bar != null && baz != null) { | ||
return foo + bar + baz; | ||
} else { | ||
return foo; | ||
} | ||
}; | ||
|
||
exports.three = (foo) => 'a'; |
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,8 +1,10 @@ | ||
import {expectError} from '../../../..'; | ||
import one, {three} from '.'; | ||
import one, {two, three} from '.'; | ||
|
||
expectError(one(true, true)); | ||
expectError(one('foo', 'bar')); | ||
|
||
expectError(two('foo', 'bar')); | ||
|
||
// Produces multiple type checker errors in a single `expectError` assertion | ||
expectError(three(['a', 'bad'])); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
module.exports.default = (foo, bar) => { | ||
return foo + bar; | ||
}; | ||
|
||
exports.two = (foo, bar) => { | ||
if (foo != null && bar != null) { | ||
return bar; | ||
} else { | ||
return foo; | ||
} | ||
}; |
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,6 +1,8 @@ | ||
import {expectError} from '../../../..'; | ||
import one from '.'; | ||
import one, {two} from '.'; | ||
|
||
expectError(one(true, true)); | ||
|
||
expectError(one<number>(1, 2)); | ||
|
||
expectError(two<number, string>(1, 'bar')); |