diff --git a/index.d.ts b/index.d.ts index 4fc599d..2a10a7a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -4,21 +4,21 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** Attempts to read filename and parse */ -export declare function readFile(filename: string, opts?: IParsingOptions): IWorkBook; +export function readFile(filename: string, opts?: IParsingOptions): IWorkBook; /** Attempts to parse data */ -export declare function read(data: any, opts?: IParsingOptions): IWorkBook; +export function read(data: any, opts?: IParsingOptions): IWorkBook; /** Attempts to write workbook data to filename */ -export declare function writeFile(data: IWorkBook, filename: string, opts?: IWritingOptions): any; +export function writeFile(data: IWorkBook, filename: string, opts?: IWritingOptions): any; /** Attempts to write the workbook data */ -export declare function write(data: IWorkBook, opts?: IWritingOptions): any; +export function write(data: IWorkBook, opts?: IWritingOptions): any; -export declare var utils: IUtils; +export const utils: IUtils; export interface IProperties { - LastAuthor?: string + LastAuthor?: string; Author?: string; CreatedDate?: Date; - ModifiedDate?: Date + ModifiedDate?: Date; Application?: string; AppVersion?: string; Company?: string; diff --git a/xlsx-tests.ts b/xlsx-tests.ts index 6051ce3..83d0b19 100644 --- a/xlsx-tests.ts +++ b/xlsx-tests.ts @@ -1,17 +1,17 @@ import xlsx = require('xlsx'); -var options: xlsx.IParsingOptions = { +const options: xlsx.IParsingOptions = { cellDates: true }; -var workbook = xlsx.readFile('test.xlsx', options); -var otherworkbook = xlsx.readFile('test.xlsx', {type: 'file'}); +const workbook = xlsx.readFile('test.xlsx', options); +const otherworkbook = xlsx.readFile('test.xlsx', {type: 'file'}); console.log(workbook.Props.Author); -var firstsheet: string = workbook.SheetNames[0]; +const firstsheet: string = workbook.SheetNames[0]; -var firstworksheet = workbook.Sheets[firstsheet]; +const firstworksheet = workbook.Sheets[firstsheet]; console.log(firstworksheet["A1"]); @@ -20,6 +20,6 @@ interface tester { age: number; } -var jsonvalues: tester[] = xlsx.utils.sheet_to_json(firstworksheet); -var csv = xlsx.utils.sheet_to_csv(firstworksheet); -var formulae = xlsx.utils.sheet_to_formulae(firstworksheet); +const jsonvalues: tester[] = xlsx.utils.sheet_to_json(firstworksheet); +const csv = xlsx.utils.sheet_to_csv(firstworksheet); +const formulae = xlsx.utils.sheet_to_formulae(firstworksheet);