Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript definition? #8

Closed
DenisCarriere opened this issue Jun 6, 2017 · 3 comments
Closed

Typescript definition? #8

DenisCarriere opened this issue Jun 6, 2017 · 3 comments

Comments

@DenisCarriere
Copy link
Contributor

@sindresorhus Any interest to include a Typescript definition to this repo? The API shouldn't be changing too much and the definition should be pretty straight forward.

I've already got something working so far, I can send a PR if you 馃憤

index.d.ts

interface Options {
    indent?: string | number
    detectIndent?: boolean
    sortKeys?: boolean
    replacer?: Function
    mode?: number
}

/**
 * https://github.com/sindresorhus/write-json-file
 */
declare function writeJsonFile(filepath: string, data: any, options?: Options): Promise<void>;
declare namespace writeJsonFile {
    function sync(filepath: string, data: any, options?: Options): void;
}
export = writeJsonFile;
@SamVerschueren
Copy link
Contributor

Sorry, it's better to publish them to DefinitelyTyped sindresorhus/ama#439

@DenisCarriere
Copy link
Contributor Author

DenisCarriere commented Jun 6, 2017

Works for me! just figured I'd ask, it's only ~10 LOC

Thanks for the reference 馃憤

@sindresorhus
Copy link
Owner

I now accept TypeScript definitions if anyone looking is interested in submitting it here.

See: sindresorhus/ama#439 (comment)

Please follow this guide: https://github.com/sindresorhus/typescript-definition-style-guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants