-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from sveyret/bettertyping
Improve typings
- Loading branch information
Showing
7 changed files
with
34 additions
and
31 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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* A simple message may be either directly a string or a function. | ||
*/ | ||
export type Message = string | ((...args: any[]) => string) | ||
|
||
/** | ||
* A message converted into a function. | ||
*/ | ||
export type MessageFunction<T extends Message> = T extends string ? () => string : T | ||
|
||
/** | ||
* The available messages for a given language. | ||
*/ | ||
export type Messages = { | ||
$: string // The language name itself | ||
} & Omit<{ [key: string]: Message }, '$'> | ||
|
||
/** | ||
* The available messages for a given language. | ||
*/ | ||
export type PartialMessages<T extends Messages> = { | ||
$: string | ||
} & Partial<Omit<T, '$'>> |
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
export { Messages, PartialMessages } from './Messages' | ||
export { Message, Messages, PartialMessages } from './MessageTypes' | ||
export { LanguageMapDefinition, LanguageMap } from './LanguageMap' | ||
export { Intl as default } from './Intl' |