ts-dedupe
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

Ts-Dedupe

A cli tool to move duplicated types and interfaces to a single file.

Features

  • Moves duplicate interfaces and types to a single file
  • Renames types / interfaces with the same name but different structure
  • Organises imports in files
  • Deletes empty files
  • Creates a barrel file exporting all types in project

Options

Argument Alias Type Description
duplicatesFile d string Path of the file where duplicate types will be moved to.
project p string Optional. Location of the tsconfig file for your project. Defaults to 'tsconfig.json'
retainEmptyFiles r boolean If specified empty files will not be removed (may cause issues if also generating a barrel file)
barrelFile b string Optional. If specified will generate a barrel file for all the files in your project.
help h boolean Displays the help guide.

Programmatic Usage

import { dedupe } from "ts-dedupe"

dedupe({duplicatesFile: "shared-types.ts"})

dedupe takes an options object that matches the options for the cli as stated above. The only required property is duplicatesFile - the location to move duplicated types to.

Dependents (0)

Package Sidebar

Install

npm i ts-dedupe

Weekly Downloads

87

Version

0.3.1

License

ISC

Unpacked Size

52.9 kB

Total Files

45

Last publish

Collaborators

  • roaders