Skip to content

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

Notifications You must be signed in to change notification settings

Roaders/ts-dedupe

Repository files navigation

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.

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published