@types/jsonlines
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

Installation

npm install --save @types/jsonlines

Summary

This package contains type definitions for jsonlines (https://github.com/LinusU/node-jsonlines#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jsonlines.

index.d.ts

/// <reference types="node" />

import { Transform } from "stream";

export interface Options {
    emitInvalidLines?: boolean | undefined;
}

/** A transform stream that turns newline separated json into a stream of javascript values. */
export class Parser extends Transform {
    // inherited (must re-declare since this is a class)
    on(event: "close" | "end" | "pause" | "readable" | "resume", listener: () => void): this;
    // added 'invalid-line'
    on(event: "error" | "invalid-line", listener: (err: Error) => void): this;
    // changed
    on(event: "data", listener: (data: any) => void): this;
    // inherited
    on(event: string | symbol, listener: (...args: any[]) => void): this;
}

/** A transform stream that turns javascript values into a stream of newline separated json. */
export class Stringifier extends Transform {
    // inherited (must re-declare since this is a class)
    on(event: "close" | "end" | "pause" | "readable" | "resume", listener: () => void): this;
    on(event: "error", listener: (err: Error) => void): this;
    // changed
    on(event: "data", listener: (data: any) => void): this;
    // inherited
    on(event: string | symbol, listener: (...args: any[]) => void): this;
}

/** Returns a transform stream that turns newline separated json into a stream of javascript values. */
export function parse(options?: Options): Parser;

/** Returns a transform stream that turns javascript values into a stream of newline separated json. */
export function stringify(): Stringifier;

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Raine Revere.

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @types/jsonlines

    Weekly Downloads

    1,216

    Version

    0.1.5

    License

    MIT

    Unpacked Size

    5.7 kB

    Total Files

    5

    Last publish

    Collaborators

    • types