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 🙏

© 2024 – Pkg Stats / Ryan Hefner

generator-typings

v1.0.13

Published

Create typings repository for `typings` (https://github.com/typings/typings)

Downloads

18

Readme

generator-typings

NPM version downloads Dependency Status Build Status Appveyor status License

Yeoman generator for typings (next-gen of tsd/DefinitelyTyped) project

Upgrade from previous version? Make sure you check the upgrade doc

Features

  • [x] Basic scaffolding
  • Source delivery mechanisms
    • [x] npm
    • [ ] bower
    • [ ] github
    • [ ] jspm
  • Source hostings providers
    • [x] github
    • [ ] bitbucket
    • [ ] gitlab
    • [ ] custom
  • [x] Install target source automatically
  • [x] Add source as submodule
  • Install supporting utilities and settings
  • Test harness
    • Server side
    • Client side
      • [ ] blue-tape (through tape-run)
      • [ ] mocha (through mocha-phantomjs, karma-mocha)
      • [ ] jasmine
      • [ ] QUnit
  • npm commands
    • [x] watch: Build typings for testing automatically
    • [ ] publish: Create PR to typings/registry
    • individual commands
      • [x] build: Build typings for testing
      • [x] lint: Run tslint
      • [x] test: Run tests
      • [x] source-test: Run tests transferred from source

Installation

First, install Yeoman and generator-typings using npm.

npm install -g yo
npm install -g generator-typings

Usage

There are several ways to create your typings repository:

Here are examples to create npm-noop2

# create the github repo from github website
# under your organization folder (e.g. /somewhere/typed-typings/)
yo typings npm-noop2

# Once it is done,
cd npm-noop2
# create the github repo from github website
# clone it locally to your machine (e.g. into /somewhere/typed-typings/npm-noop2/)
# in that directory:
yo typings
# create the github repo from github website
# under your organization folder (e.g. /somewhere/typed-typings/)
mkdir npm-noop2 && cd npm-noop2
yo typings

How to write typings

  • https://github.com/typings/typings
  • https://github.com/typings/typings/blob/master/docs/faq.md
  • https://github.com/typings/typings/blob/master/docs/examples.md
  • https://github.com/unional/typescript/tree/master/pages/typings

About writing tests for typings

Simply shape test (like those in DefinitlyType) is not sufficient. Since there is no type in javascript, even if you create a wrong signature, you won't detect it until runtime.

e.g.

// source code
function foo(something) {
  return something++;
}

The source code expects something to be a number. If you write your typings as:

function foo(something: string): string;

It won't fail until you use it. i.e.

// consumer program
import foo ....somehow

let x = "abc";
foo(x);

Because your typings provide guidance to the consumer, they will write their code that way and will fail when they run it. tsc will compile fine.

License

MIT © unional