Skip to content

typings file structure best practices #15

@unional

Description

@unional

Originally I tend to organize typings in multiple files so that they are more manageable. e.g. npm-chai.

But now through the conversation in UMD, and best practice of exposing types, it seems like it is actually best to keep them in 1 file (or 2, if we can't nicely solve the UMD issue microsoft/TypeScript#7125 and microsoft/TypeScript#7156)

The key statement is this:
"how would it look like if the package is actually written in TypeScript and compiled using tsc -d"?
It has the following benefits:

  • Non-argumentative
  • Simple to define, simple to follow
  • No need to think about folder structure (lib or src? Nested or mirror source structure?)
  • The .d.ts file can easily be moved into the source package when package author agrees

Relevant discussions:
typings/typings#402
typings/typings#10
typings/typings#354

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