Skip to content

Commit

Permalink
Merge pull request #62 from Rich-Harris/declarations
Browse files Browse the repository at this point in the history
Start adding declarations
  • Loading branch information
mhkeller committed Sep 8, 2017
2 parents 4e0bd9a + 807e109 commit 209646f
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
93 changes: 93 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
interface WriteOptions {
replacer?: ((key: string, value: any) => any) | (string | number)[];
indent?: number;
writeMethod?: 'safeDump' | 'dump';
columns?: string[];
callback?: (err: Error, dataString: string) => void;
}

type Formatter = (file: string, options: WriteOptions) => string;

interface ParserOptions {
// TODO
}

type Parser = (str: string, options: ParserOptions) => any;

// converters
export function convertDbfToData(
inFileName: string,
outFileName: string,
callback: (err: Error) => void
): void;

export function convertDbfToData(
inFileName: string,
outFileName: string,
options: { makeDirectories: boolean },
callback: (err: Error) => void
): void;

// helpers
export function deepExtend<T>(
destination: T,
...sources: object[]
): T;

export function discernFileFormatter(
fileName: string
): Formatter;

export function discernFormat(
fileName: string
): string;

export function discernParser(
fileName: string,
delimiter?: string
): Parser;

export function exists(
fileName: string,
callback: (err: Error, exists: boolean) => void
): void;

export function existsSync(
fileName: string
): boolean;

export function extend<T>(
deep: boolean,
destination: T,
...sources: T[]
): T;

export function extend<T>(
destination: T,
...sources: T[]
): T;

export function extMatchesStr(
fileName: string,
extension: string
): boolean;

export function makeDirectories(
outPath: string,
callback: (err: Error) => null
): void;

export function makeDirectoriesSync(
outPath: string
): void;

export function matches(
fileName: string,
matcher: string | RegExp
): boolean;

export function matchesRegExp(
fileName: string,
regex: RegExp
): boolean;

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "dist/indian-ocean.node.js",
"browser": "dist/indian-ocean.browser.es6.js",
"module": "index.node.js",
"types": "index.d.ts",
"scripts": {
"docs-view": "npm run build-docs && npm run serve-docs",
"coverage": "istanbul cover mocha -- -R spec",
Expand Down

0 comments on commit 209646f

Please sign in to comment.