Merge pull request #34 from septs/master

rewrite typescript definition file
This commit is contained in:
Ruben Vermeersch 2019-06-25 13:31:05 +02:00 committed by GitHub
commit 6357bf3edd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

41
pofile.d.ts vendored
View File

@ -1,18 +1,4 @@
declare module pofile {
function parse(data: string): PO;
function load(fileName: string, callback: (err: NodeJS.ErrnoException | null, po: PO) => void): void;
class PO {
public comments: string[];
public extractedComments: string[];
public items: Item[];
public headers: Partial<IHeaders>
public save(filename: string, callback: (err?: NodeJS.ErrnoException) => void): void;
public toString(): string;
}
interface IHeaders {
declare interface IHeaders {
'Project-Id-Version': string;
'Report-Msgid-Bugs-To': string;
'POT-Creation-Date': string;
@ -23,9 +9,10 @@ declare module pofile {
'Content-Type': string;
'Content-Transfer-Encoding': string;
'Plural-Forms': string;
}
[name: string]: string;
}
class Item {
declare class Item {
public msgid: string;
public msgctxt?: string;
public references: string[];
@ -33,12 +20,26 @@ declare module pofile {
public msgstr: string[];
public comments: string[];
public extractedComments: string[];
public flags: { [flag: string]: boolean | undefined }
public flags: Record<string, boolean | undefined>;
private nplurals: number;
private obsolete: boolean;
public toString(): string;
}
}
export = pofile
declare class PO {
public comments: string[];
public extractedComments: string[];
public items: Item[];
public headers: Partial<IHeaders>
public static parse(data: string): PO;
public static parsePluralForms(forms: string): PO;
public static load(fileName: string, callback: (err: NodeJS.ErrnoException, po: PO) => void): void;
public static Item: typeof Item;
public save(fileName: string, callback: (err: NodeJS.ErrnoException) => void): void;
public toString(): string;
}
export = PO