Skip to content

Commit

Permalink
add d.ts to support typescript (#14)
Browse files Browse the repository at this point in the history
support typescript types
  • Loading branch information
zhanba authored and creeperyang committed Jun 21, 2018
1 parent e8eab40 commit c6b3ba9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tiny-pinyin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
declare namespace TinyPinyin {
interface DICT {
PINYINS: string[]
UNIHANS: string[]
EXCEPTIONS: {
[code: string]: string
}
}
interface Patcher {
(DICT: DICT): void
}
export function isSupported(force?: boolean): boolean
export function parse(
str: string
): {
type: 1 | 2 | 3
source: string
target: string
}[]
export function convertToPinyin(str: string, separator?: string, lowerCase?: boolean): string
export function patchDict(patcher: Patcher | Patcher[]): void
}

declare module 'tiny-pinyin' {
export = TinyPinyin
}

0 comments on commit c6b3ba9

Please sign in to comment.