-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generalize TypeScript declaration (#20)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
- Loading branch information
1 parent
cde3c6f
commit 66079d9
Showing
2 changed files
with
10 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
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,5 +1,12 @@ | ||
import {expectType, expectError} from 'tsd'; | ||
import importFresh = require('.'); | ||
import path = require('path'); | ||
|
||
expectType<unknown>(importFresh('hello')); | ||
expectError(importFresh()); | ||
|
||
expectType<(moduleId: string) => {}>(importFresh<(moduleId: string) => {}>('hello')); | ||
expectType<path.PlatformPath>(importFresh<path.PlatformPath>('path')); | ||
|
||
const foo = importFresh<path.PlatformPath>('path'); | ||
expectType<path.PlatformPath>(foo); |