sindresorhus / hook-std

Hook and modify stdout and stderr
MIT License
54 stars 12 forks source link

TypeScript support #14

Closed alem0lars closed 6 years ago

alem0lars commented 6 years ago

The following are the types to include typescript support in your project:

export type UnhookFunctionType = () => void;
export type HookOpts = { silent: boolean; once: boolean };
export type HookCallback = (str: string, enc: string) => string | boolean;

export function stdout(
  opts: HookOpts | HookCallback,
  cb?: HookCallback
): UnhookFunctionType;

export function stderr(
  opts: HookOpts | HookCallback,
  cb?: HookCallback
): UnhookFunctionType;

They should be added to index.d.ts in order to provide types out-of-the-box.

SamVerschueren commented 6 years ago

Sorry, it's better to publish them to DefinitelyTyped https://github.com/sindresorhus/ama/issues/439. We don't care in maintaining typedef ourselves.

sindresorhus commented 6 years ago

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

See: https://github.com/sindresorhus/ama/issues/439#issuecomment-414212229

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