Options
All
  • Public
  • Public/Protected
  • All
Menu

Version 0.5

Welcome to the ts-merge API documentation!

The main components for end-users of this module are:

  • FileWorker - A multi-file unit worker, that uses the dts and js processors and can work synchronously or asynchronously;
  • DtsProcessor - A single-file declaration (.d.ts) file processor;
  • JsProcessor - A single-file JS and sourcemap (.js and .js.map) file processor.

Feel free to submit any issues, questions, or suggestions to https://github.com/pjbatista/ts-merge.


Copyright (c) 2017 Pedro Batista

Index

Type aliases

LoggerFunction

LoggerFunction: function

Represents the callback function used as a logger for ts-merge.

Type declaration

    • (message: string, level?: LogLevel, newLine?: undefined | true | false): void
    • Parameters

      • message: string
      • Optional level: LogLevel
      • Optional newLine: undefined | true | false

      Returns void

Functions

extendOptions

  • extendOptions<T>(type: "generate" | "merge" | "parse", options?: T): T
  • Extends a default options object with new values.

    throws

    Error when the type is invalid.

    Type parameters

    • T: GenerateOptions | MergeOptions | ParseOptions

      Type of options object used to extend its default.

    Parameters

    • type: "generate" | "merge" | "parse"

      "generate" (for escodegen GenerateOptions), "merge" (for ts-merge MergeOptions), "parse" (for esprima ParseOptions).

    • Optional options: T

      An object with the options to be added to the default (it will replace any default value).

    Returns T

    The extended object instance.

streamFunction

  • This is a function that wraps the TypeScript Merger functionality into Node.JS streams, and is useful when the merging needs to be streamed in a pipeline.

    example

    Using tsmerge with gulp

    // Both ways are correct to import the stream worker:
    var tsmerge = require('ts-merge').stream;
    var tsmerge = require('ts-merge').streamFunction;
    
    gulp.task('merge', function() {
      gulp
        .src(['*.ts', '*.d.ts'])
        .pipe(tsmerge({ extensionPrefix: 'compact' }))
        .pipe(gulp.dest('.'));
    });
    

    For more information, see MergeOptions.

    Parameters

    Returns ReadWriteStream

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc