Search code examples
typescripttypescript-typingsdefinitelytyped

Is DefinitelyTyped appropriate for new TypeScript definitions?


According to https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/:

DefinitelyTyped will still be the place to author new declaration files.

But it's unclear why we'd create new definitions at DefinitelyTyped as opposed to submitting them directly to NPM.

Being that DT is so large now, it seems counter productive to continue adding to that repo. What are the advantages of DT over publishing to NPM directly?


Solution

  • The DefinitelyTyped repo is being treated as the endorsed community repository of type declarations for packages that don't provide their own.

    Answering this question depends on what you mean when you say

    submitting them directly to NPM.

    If you mean including the .d.ts file with the package that the .d.ts file corresponds to that's encouraged. The moment package, for example, includes and maintains its own declaration file.

    If you mean providing your own type only package then DefinitelyTyped is the better location for those files and will provide some advantages. By including your file in DefinitelyTyped it will

    • benefit from automated deploys to the @types namespace by the TS typings bot.
      • which will also yield predictable module resolution in the compiler.
    • be in the long established source for typings. You'll be where people are looking.
    • be more easily maintained by others.
      • the package will be easier to find
      • maintainers will use a workflow and format they're familiar with