-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor TypeScript definition to CommonJS compatible export (#13)
- Loading branch information
1 parent
254cdab
commit 1051a46
Showing
4 changed files
with
32 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,21 @@ | ||
/** | ||
* Measure the difference between two strings. | ||
*/ | ||
export default function leven(left: string, right: string): number; | ||
declare const leven: { | ||
/** | ||
Measure the difference between two strings. | ||
@example | ||
``` | ||
import leven = require('leven'); | ||
leven('cat', 'cow'); | ||
//=> 2 | ||
``` | ||
*/ | ||
(left: string, right: string): number; | ||
|
||
// TODO: Remove this for the next major release, refactor the whole definition to: | ||
// declare function leven(left: string, right: string): number; | ||
// export = leven; | ||
default: typeof leven; | ||
}; | ||
|
||
export = leven; |
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,4 +1,4 @@ | ||
import {expectType} from 'tsd-check'; | ||
import leven from '.'; | ||
import {expectType} from 'tsd'; | ||
import leven = require('.'); | ||
|
||
expectType<number>(leven('kitten', 'sitting')); |
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