Skip to content

Provide type definitions for common-errors #27

Open

Description

@jimjaeger

Can you provide type defintions in your project or trigger a separate task as described here:
https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html
Usually the owner of a npm module add the definition in the repo:
https://github.com/DefinitelyTyped/DefinitelyTyped
and the build process automatically push a new type module to npm.

Activity

  1. RichardLitt commented on Aug 24, 2017

    @RichardLitt
    Contributor

    @dfenster What do you think about this?

  2. dfenster commented on Sep 10, 2017

    @dfenster
    Contributor

    Is this really a desired feature? I haven't ever wanted to use TypeScript personally since I love dynamically typed languages, and I have an affinity to stick with native JS. A while ago, someone submitted a PR that I rejected because I didn't want to maintain it for a small user-base. #24

    Can you confirm this PR is what you want, and can you also show me that this adds value to people?

  3. jimjaeger commented on Sep 15, 2017

    @jimjaeger
    Author

    Hi David,

    yes definition files for the package would be great. I am not sure about the content of the PR but the value of a type definition of your package. More and more developer in my team if more packages exists with the same idea select a package with type definition instead of a other.

    It would support developers with typesafe development during transpiling but also in during development time because IDEs can check if the usage of the package is correct. And typesafe development become more and more popular in production development. Also plain nodeJS developers would get support from IDEs. As Javascript/Node developer using for example VSCode the IDE you also give you help for attributes and functions if the type definition is available.

    added value to people:

    • support during development (type check)
    • support during development (in place documentation and help)
    • ensure production code use correct function syntax (transpiling check)

    The type definition document is a formalized version of your text documentation.

  4. dfenster commented on Nov 8, 2017

    @dfenster
    Contributor

    I'm still not sure if it's worth adding Typescript to this project. If enough people subscribe to this issue or comment in it, I'll maintain some typescript definitions.

    I'll leave the issue open as a result.

  5. erkiesken commented on Jan 10, 2018

    @erkiesken

    I just had a need for types for common-errors, resorted to defining our own override types for the API surface we needed right now (some Error types and helper/generateClass stuff). Followed these instructions for now but would be nice to have proper full typings from @types.

  6. wosevision commented on Feb 16, 2018

    @wosevision

    Also needed @types for common-errors, searched the main repo, found none, generated my own.

    Here's my number one argument in favour of adding TS definitions to libraries: it adds literally no friction for users that don't use it, and significantly reduces friction for users that do. I can't count how many times I've installed a new library and been positively delighted when my IDE started to help me learn this new library automagically.

    Producing them is trivial; even if you're not into the game of writing quality TS defs (which there is a lot to be said for), you can generate them – just like I did – as part of your build process using dts-gen without having to think about it. Your users won't get all the nice pop-up documentation that goes with well-written defs, but they'll at least be able to see what properties your objects have as they're typing.

    This isn't just about static/dynamic typing – there's a lot more to gain here.

  7. abdulhannanali commented on Jul 25, 2018

    @abdulhannanali

    Yes TypeScript definitions are definitely useful. @dfenster You should really add them

  8. darbio commented on May 26, 2020

    @darbio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions