Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return
undefined
instead of null
when the path cannot be found
- Loading branch information
1 parent
905e612
commit a7a9500
Showing
5 changed files
with
94 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import {expectType} from 'tsd'; | ||
import findUp = require('.'); | ||
|
||
expectType<Promise<string | null>>(findUp('unicorn.png')); | ||
expectType<Promise<string | null>>(findUp('unicorn.png', {cwd: ''})); | ||
expectType<Promise<string | null>>(findUp(['rainbow.png', 'unicorn.png'])); | ||
expectType<Promise<string | null>>( | ||
findUp(['rainbow.png', 'unicorn.png'], {cwd: ''}) | ||
); | ||
expectType<Promise<string | undefined>>(findUp('unicorn.png')); | ||
expectType<Promise<string | undefined>>(findUp('unicorn.png', {cwd: ''})); | ||
expectType<Promise<string | undefined>>(findUp(['rainbow.png', 'unicorn.png'])); | ||
expectType<Promise<string | undefined>>(findUp(['rainbow.png', 'unicorn.png'], {cwd: ''})); | ||
|
||
expectType<string | null>(findUp.sync('unicorn.png')); | ||
expectType<string | null>(findUp.sync('unicorn.png', {cwd: ''})); | ||
expectType<string | null>(findUp.sync(['rainbow.png', 'unicorn.png'])); | ||
expectType<string | null>( | ||
findUp.sync(['rainbow.png', 'unicorn.png'], {cwd: ''}) | ||
); | ||
expectType<string | undefined>(findUp.sync('unicorn.png')); | ||
expectType<string | undefined>(findUp.sync('unicorn.png', {cwd: ''})); | ||
expectType<string | undefined>(findUp.sync(['rainbow.png', 'unicorn.png'])); | ||
expectType<string | undefined>(findUp.sync(['rainbow.png', 'unicorn.png'], {cwd: ''})); |
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
Oops, something went wrong.