Giter Site home page Giter Site logo

Comments (9)

levsthings avatar levsthings commented on July 3, 2024 2

Well, you can't just use a module without type definitions in a TypeScript project, you get errors.

So we either
1- Add local definitions
2- Submit definitions to the module itself.
3- Submit definitions to this repository.

Adding them to the DefinitelyTyped repository is by far the best method for future sync between the module and it's definitions, but it involves adding tests as well. So until someone wants to do that, I can just share the definitions.

declare module 'circular-dependency-plugin' {
  import { Compiler, Plugin } from 'webpack'

  interface CircularDependencyPluginOptions {
    exclude?: RegExp
    failOnError?: boolean
  }

  class CircularDependencyPlugin implements Plugin {
    constructor(options?: CircularDependencyPluginOptions)
    apply(compiler: Compiler): void
  }

  namespace CircularDependencyPlugin { }

  export = CircularDependencyPlugin
}

from circular-dependency-plugin.

aackerman avatar aackerman commented on July 3, 2024 1

I was just unclear about what tests could be created for a type definition file.

Please do go ahead and submit a PR to add the type definitions.

from circular-dependency-plugin.

aackerman avatar aackerman commented on July 3, 2024

Can you post it as part of a comment? I'm unclear on what benefit a TS/Flow user would get from it for this project.

from circular-dependency-plugin.

aackerman avatar aackerman commented on July 3, 2024

but it involves adding tests as well

Can you explain more about what you mean by this?

from circular-dependency-plugin.

aackerman avatar aackerman commented on July 3, 2024

Aside from that yes, I would accept a PR for adding the types. I assume in an index.d.ts file?

from circular-dependency-plugin.

levsthings avatar levsthings commented on July 3, 2024

Sorry if I wasn't clear in my initial message.

Can you explain more about what you mean by this?

The testing part was for this option:

3- Submit definitions to this repository.

According to their contribution guidelines, a contributor has to submit the types along with some tests. If someone wrote those tests and adds the definition file that repository, then TS users are able to get these via:
npm install circular-dependency-plugin
npm install @types/circular-dependency-plugin

The benefit of adding the definitions there is that the types will have their own versioning so it'll be easy for community to update them as your API changes without knocking on your door.

2- Submit definitions to the module itself.

This option involves just adding the index.d.ts file to your repo, no tests are not mandatory. The definitions will be pulled automatically and the TS compiler will be happy. The downside of this method is if your API changes, you should update the definition file yourself as the maintainer of the module.

I'm not saying you should do this or do the other, I'm just bringing the definitions in case anyone is interested in maintaining them or maybe submitting them to DefinitelyTyped. :)

from circular-dependency-plugin.

aackerman avatar aackerman commented on July 3, 2024

I'm going to close this as it's not something I'm willing to take on myself, but I would still accept a PR.

from circular-dependency-plugin.

alecmev avatar alecmev commented on July 3, 2024

Why close this? I'd just tag with help-wanted instead.

from circular-dependency-plugin.

alecmev avatar alecmev commented on July 3, 2024

DefinitelyTyped/DefinitelyTyped#33952

from circular-dependency-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.