npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@razmans/types-checker

v1.0.12

Published

A CLI to detect duplicate TypeScript interfaces in a project

Readme

Types Checker

A TypeScript CLI tool that detects duplicate interfaces across your codebase by analyzing their structure rather than just their names. This helps identify interfaces that have identical properties but different names, which could be candidates for consolidation.

Features

  • 🔍 Smart Detection: Finds interfaces with identical property structures, regardless of their names
  • 📁 Recursive Scanning: Analyzes single files or entire directories recursively
  • 🎯 Property-Based Comparison: Compares interfaces by their actual properties and types, not just names
  • 💡 Merge Suggestions: Provides suggested interface definitions for consolidation
  • Fast Analysis: Built with ts-morph for efficient TypeScript AST parsing

Installation

npm install -g @razmans/types-checker

Usage

Command Line Interface


# Analyze a single file
npx @razmans/types-checker ./src/types.ts

# Analyze an entire directory
npx @razmans/types-checker ./src

Example Output

When duplicates are found:

Duplicate interfaces found:
- User (./test/detected/file1.ts)
- Customer (./test/detected/file2.ts)

Suggested merge:
interface User {
  id: string;
  name: string;
  email: string;
}

When no duplicates are found:

No duplicate interfaces found.

How It Works

The tool analyzes TypeScript interfaces by:

  1. Parsing: Uses ts-morph to parse TypeScript files and extract interface declarations
  2. Serialization: Converts each interface's properties into a normalized format for comparison
  3. Comparison: Groups interfaces with identical property structures
  4. Reporting: Shows which interfaces are duplicates and suggests merged definitions

Example

Consider these two files:

file1.ts

export interface User {
  id: string;
  name: string;
  email: string;
}

file2.ts

export interface Customer {
  id: string;
  name: string;
  email: string;
}

The tool will detect that User and Customer have identical structures and suggest they could be consolidated.

Development

Project Structure

├── index.ts              # CLI entry point
├── functions/
│   ├── helper.ts         # Core logic for finding duplicates
│   └── interface.ts      # Type definitions
├── test/
│   ├── detected/         # Test cases with duplicates
│   └── not-detected/     # Test cases without duplicates
└── package.json

Testing

The project includes test cases in the test/ directory:

  • test/detected/: Contains interfaces that should be flagged as duplicates
  • test/not-detected/: Contains interfaces that should not be flagged

Dependencies

  • ts-morph: TypeScript AST manipulation
  • commander: CLI framework
  • typescript: TypeScript compiler

License

ISC

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Use Cases

  • Code Cleanup: Identify redundant interface definitions before refactoring
  • Code Review: Catch duplicate interfaces during development
  • Legacy Codebase Analysis: Find consolidation opportunities in large codebases
  • CI/CD Integration: Automate duplicate detection in your build pipeline

Limitations

  • Only analyzes TypeScript interface declarations
  • Does not handle complex generic types or conditional types
  • Property order is normalized, so interfaces with the same properties in different orders are considered duplicates