50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
declare module '@retorquere/bibtex-parser' {
|
|
// Represents a single author/creator object inside the author array
|
|
export interface Creator {
|
|
firstName?: string;
|
|
lastName?: string;
|
|
prefix?: string;
|
|
suffix?: string;
|
|
initial?: string;
|
|
useprefix?: boolean;
|
|
family?: string;
|
|
given?: string;
|
|
name?: string;
|
|
}
|
|
|
|
// Represents the fields object inside an entry.
|
|
// 'author' is specifically typed, everything else is treated as an array of strings or a single string.
|
|
export interface Fields {
|
|
author?: Creator[];
|
|
editor?: Creator[];
|
|
translator?: Creator[];
|
|
title?: string | string[];
|
|
journal?: string | string[];
|
|
booktitle?: string | string[];
|
|
year?: string | string[];
|
|
url?: string | string[];
|
|
[key: string]: any; // Catch-all for other BibTeX fields (volume, pages, publisher, etc.)
|
|
}
|
|
|
|
// Represents a single parsed BibTeX entry
|
|
export interface Entry {
|
|
type: string;
|
|
key: string;
|
|
fields: Fields;
|
|
crossref?: any;
|
|
creators?: Record<string, Creator[]>;
|
|
}
|
|
|
|
// Represents the overall output of the parse function
|
|
export interface Library {
|
|
entries: Entry[];
|
|
errors: any[];
|
|
comments: string[];
|
|
strings: Record<string, string>;
|
|
jabref?: any;
|
|
}
|
|
|
|
// The main parse function you are importing
|
|
export function parse(input: string, options?: any): Library;
|
|
export function parseAsync(input: string, options?: any): Promise<Library>;
|
|
} |