-
-
Notifications
You must be signed in to change notification settings - Fork 10
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 (#3)
- Loading branch information
1 parent
1b9dbc6
commit 578e6a9
Showing
4 changed files
with
32 additions
and
11 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,6 +1,26 @@ | ||
/** | ||
* Capitalize every word in a string: `unicorn cake` → `Unicorn Cake`. | ||
* | ||
* @param input - The string to titleize. | ||
*/ | ||
export default function titleize(input: string): string; | ||
declare const titleize: { | ||
/** | ||
Capitalize every word in a string: `unicorn cake` → `Unicorn Cake`. | ||
@param input - The string to titleize. | ||
@example | ||
``` | ||
import titleize = require('titleize'); | ||
titleize('foo bar'); | ||
//=> 'Foo Bar' | ||
titleize('foo-bar'); | ||
//=> 'Foo-Bar' | ||
``` | ||
*/ | ||
(input: string): string; | ||
|
||
// TODO: Remove this for the next major release, refactor the whole definition to: | ||
// declare function titleize(input: string): string; | ||
// export = titleize; | ||
default: typeof titleize; | ||
}; | ||
|
||
export = titleize; |
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 titleize from '.'; | ||
import {expectType} from 'tsd'; | ||
import titleize = require('.'); | ||
|
||
expectType<string>(titleize('foo bar')); |
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