Giter VIP home page Giter VIP logo

registry's Introduction

Typings Registry

The registry of type definitions for TypeScript.

Contributing

As package author

You can create typings and distribute them with your NPM package. Check out how we can collaborate (if you need help) in this issue. The TypeScript team gives some additional help in their handbook, which entails creating a definition in external module format and linking to it from package.json. Feel free to ask questions!

Ask the author

You can open an issue in the package's repository and ask if they'd be interested in providing a TypeScript definition for their users. If they are, you can link them to this issue on collaborating, in case they need a hand getting started.

Contribute yourself

  1. Fork the registry and run npm install
  2. Write a typings definition and upload to GitHub - here's an example using NPM's debug package
  3. Use semver to specify the minimum version the typings are valid for in the registry - here's debug again
  4. Commit and run npm test to check that the registry is valid, make a pull request
  5. Once the pull request is merged, it will be used as the canonical reference - typings install debug

Links

  • Typings requests are labelled with typings request in the issues
  • If you'd like to help review PRs to the registry, see #70 to help out
  • If you're wondering how to write tests for your typings, see #150
  • If you'd like to help collaborate on types, see #480 so we can collaborate
  • If you'd like to lint your definitions, try tslint-config-typings

Creating Typings

  • Initialize a new repository (usually typed-<package name> to differentiate from your other projects)
  • Use generator-typings to generate the project, or manually:
    • Create a typings.json file, set main (and other valid options)
    • Make sure there's a license with your work
    • A README can help explain what people are looking at when they land on your repo

Structure

The registry uses subdirectories to denote "sources". These sources are essentially mappings to package managers, and contain either ambient or external module typings (depending on the "source").

/<source>/<name>.json

Where "source" is one of:

  • npm for NPM dependencies (external)
  • github for Duo, JSPM, etc. that use GitHub as the registry (external)
  • bower for Bower dependencies (external)
  • common for "standard" JS libraries without a "source" (external)
  • shared for shared library functionality (external)
  • lib for shared environment functionality (global)
  • env for programming environment typings (global)
  • global for global libraries (global)

And "name" is the name of the package from the source. For GitHub and scoped NPM packages, it's valid to make a folder such as @example/entry.json. The schema for package files is described using JSON schema in schema.json.

Questions?

For typings issues, questions or general help, you can always open an issue in the discussions repo. To add an entry to the registry, please open a pull request with the change.

registry's People

Contributors

adaball avatar asvetliakov avatar blakeembrey avatar bossqone avatar caselit avatar demurgos avatar effervescentia avatar eseliger avatar fank avatar felixfbecker avatar giedriusgrabauskas avatar goenning avatar greenkeeperio-bot avatar j-oliveras avatar jessezhang91 avatar jgoz avatar jkeylu avatar joewashear007 avatar louy avatar lukephills avatar mxl avatar nickzelei avatar patrickjs avatar protectator avatar rapropos avatar samvloeberghs avatar somaticit avatar tkqubo avatar unional avatar zaytsevvla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

registry's Issues

test fails on windows

Hey, love the project so far. I have tracked down an issues on windows with the test command.

Details

  • The output of git diff --name-status HEAD~1 is A npm/sentiment.json.
  • The test tries to split apart npm/sentiment using the file system separator, which in window is \
  • So the split never happens, cause the test script fail

Fixes

  • This line seemed to be the issue. Replacing it with var sep = "/" makes it work.

How to fix bluebird.d.ts Duplicate identifier 'Promise' error?

When I run tsc -d on my project that use bluebird (i.e. installing typed file with typings install bluebird --ambient), I run into this:

typings/browser/ambient/bluebird/bluebird.d.ts(21,15): error TS2300: Duplicate identifier 'Promise'.
typings/browser/ambient/bluebird/bluebird.d.ts(637,16): error TS2300: Duplicate identifier 'Promise'.

The corresponding lines:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/ffceea9dd124d277c4597c7bd12930666ec074c5/bluebird/bluebird.d.ts#L19
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/ffceea9dd124d277c4597c7bd12930666ec074c5/bluebird/bluebird.d.ts#L629

What should I do to:

  • fix it
  • move it to typings/registry

Expand registry entry details

From typings/typings#49, the registry should support extra information. Currently this is defined in the schema: https://github.com/typings/registry/blob/master/schema.json. New support should look like:

{
  "versions": {
    "2.0.0": [
      "github:foo/bar#commitish",
      {
        "compiler": "1.5.2", // Maybe it should specify the range or just imply greater than? E.g. "> 1.5.2".
        "location": "github:foo/bar-legacy#commitish",
        "description": "This is a legacy definition..."
      }
    ]
  }
}

Good time to think about other fields that might eventually need to be added too.

Typings for ES7

Would be nice to get some typings for features in ES7 and late stages of other proposed language extensions.

Thanks.

Typings for Firebase

Not sure where to submit this, since TSD is being deprecated. But it looks like the DT typings for Firebase are a little outdated.

Some of the methods return promises now.

Port toolings type file with higher priority?

Propose to port tools such as gulp, mocha, jasmine, chai, etc over to typings first.

Currently, without porting them over, typings i -D ... would cause unnecessary compile error because browser.d.ts and main.d.ts include dev dependencies just like regular dependencies.

So tsc will fail with error such as:

typings/browser/ambient/gulp/gulp.d.ts(10,35): error TS2307: Cannot find module 'orchestrator'.
typings/browser/ambient/gulp/gulp.d.ts(50,31): error TS2503: Cannot find namespace 'NodeJS'.
typings/browser/ambient/gulp/gulp.d.ts(60,66): error TS2503: Cannot find namespace 'NodeJS'.
typings/browser/ambient/gulp/gulp.d.ts(67,68): error TS2503: Cannot find namespace 'NodeJS'.
typings/browser/ambient/gulp/gulp.d.ts(75,85): error TS2503: Cannot find namespace 'NodeJS'.
typings/browser/ambient/gulp/gulp.d.ts(83,87): error TS2503: Cannot find namespace 'NodeJS'.
typings/browser/ambient/gulp/gulp.d.ts(95,80): error TS2503: Cannot find namespace 'NodeJS'.
typings/browser/ambient/gulp/gulp.d.ts(104,56): error TS2503: Cannot find namespace 'NodeJS'.

because of typings i -D gulp --ambient, while without that it is building fine.

multiple versions of same package in same repo

Is it possible to put multiple versions of the same package definitions in one repository without having to use tags/branches/commits.

Something like using folders and github:louy/typed-package/v0.1.0#COMMIT.

Run tests on changed files only

Currently the test suite is being run on all files, every PR/check in. It would be faster for it to run on only the changes compared to master.

Test Suite for Writing Typings

Relevant information for anyone writing Typings definitions and wanting to execute tests.

I saw @unional has been installing definitions into themselves as part of the dev dependencies, but there's actually a simpler way - use typings bundle. I implemented this while testing https://github.com/typed-typings/npm-batch, and I combined it with ts-node to create a simple test suite of both the runtime and compile time since ts-node will crash on compiler errors.

Relevant implementation: https://github.com/typed-typings/npm-batch/blob/master/package.json

I'll keep this open for anyone that needs guidance on implementing Typings.

Add registry entry to CLI tool

This should reduce friction that little bit more to adding to the registry. Something like typings register [email protected] --scope npm --src github:typings/typed-foobar, which will open a PR on behalf of the user.

We passed 100 typings for NPM alone!

I think it's pretty cool. How long will it take to get to 200, 1000, 2000? Can it surpass DefinitelyTyped (that'll definitely help for future proofing with some things upcoming in TypeScript)? Just wanted to make this so people have visibility into progress so far. I'll be closing it right after ๐Ÿ˜„

Reference: https://api.typings.org/search?source=npm

Tooling for creating typed-typings repos

While I really like the idea behind typed-typings, I fear it's going to be really painful to get contributions without some tooling.

Current pain points:

  • A lot of boilerplate in typings repos
    • Ideally, I should be able to take a .d.ts that's been written & used in one of my projects, and "push" it to typed-typings with minimal effort
    • A Yeoman generator, or similar tool, might be able to streamline that?
  • Managing the typed-typings org (adding contributors), seems like it'll be annoying, particularly since most potential contributions are one-off

Compile a list of example repo

For each common module shape:

  • one function (e.g. domready)
  • immutable utility (e.g. lodash)
  • utility + function (e.g. jquery)
  • utility + class (e.g. bluebird), identical to class with static?
  • multiple subpath modules (e.g. core-js, material-ui, ext-js)
  • sub-modules (e.g. node), any better name?

All suggestion welcome!

This will be added as docs/examples.md later.

Unable to connect to "https://api.typings.org/search?name=debug&ambient=false"

Hi,

I am migrating from TSD to Typings and following instructions:
I have installed it with npm globally.

When I run typings install debug --save I get an error message

typings ERR! message Unable to connect to "https://api.typings.org/search?name=debug&ambient=false"
typings ERR! caused by getaddrinfo ENOTFOUND api.typings.org api.typings.org:443

typings ERR! cwd /Users/leblanc/www/projectX
typings ERR! system Darwin 15.3.0
typings ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/typings/dist/bin/typings-install.js" "debug" "--save"
typings ERR! node -v v5.3.0
typings ERR! typings -v 0.6.6
typings ERR! code EUNAVAILABLE

typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues

I am able to install typings however I noticed my IDE (Code or Sublime3) not picking them up like it did with TSD.
So I wondered if that install is required for that. But then it runs into an error.
Does anyone have an idea?

contribution guide

Hi,

Is there a contribution guide available? I want to merge some projects but don't really have the time to find out how at the moment.

Good job on the project!
Grtz

Documentation

I often see PR's which have an ambient or old declarations.
So the idea was about adding an contribution guide with following infos:

  • What is the difference between typings definitions in tds and typings
  • Some example of how a typings looks like (prefered for newbies)
    • Export a function
    • Export a class
    • Export an object
    • ...
  • How the folder structure of an typing should looks like
  • What is the difference between the folder (npm and global) folder in the registry repo

@typings/registry What do you think?

installing foundation-sites gives error

Hello,

So i've tried to install the foundation-sites typings I've added recently into a project.
It gives me this error, and I don't quite understand it :)

C:\Users\svloeberghs\Documents\angular2-webpack-starter>typings install foundation-sites
? Found typings for foundation-sites in multiple registries Ambient
Installing [email protected] (Ambient)...

typings ERR! message Attempted to compile "foundation-sites" as a dependency, but it contains ambient modules ("Foundation"). Did you w
ant to specify "--ambient" instead?

typings ERR! cwd C:\Users\svloeberghs\Documents\angular2-webpack-starter
typings ERR! system Windows_NT 6.1.7601
typings ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\svloeberghs\\AppData\\Roaming\\npm\\node_modules\\typings\\dist\
\bin\\typings-install.js" "foundation-sites"
typings ERR! node -v v4.2.1
typings ERR! typings -v 0.5.1

typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues>

I did specify ambient in the choice it gave me.
Any thoughts on this?

Grtz

Should definitions that make it into the registry have tests?

I realised that the definitions in the registry had no sign of tests that I could see.

Whilst the tests in Definitely Typed are not your classic unit tests per se and actually just test that compilation of code is possible with the definitions available they are useful to have in place to catch any breaking changes people might introduce. This was necessary since DT is a giant repo which contains all the definitions and this does not apply to Typings. That said, is there a desire/need for some kind of testing around the typings that end up in the registry?

If so, what would make sense / be useful in Typings-land?

Typings for json-api-store

Would like to use the json-api-store library from typescript. I'll take a stab at creating one, but it's not clear how to do that yet.

Create a bot that auto-links registry PRs

  • Link to the project (homepage in typings.json, issues, source code, etc.)
  • Link to the definition in its current form (specific SHA)
  • Expose additional information - for ambient, global interfaces/modules/etc found, etc.

Add `exists` field to registry entries

This flag will point to the semver version(s) when the typings were included in the package itself. If the user is between these versions, we can print a warning for them in tooling.

Difference between ambient and npm folders ?

Hi @blakeembrey ,

I have just finished a typed-electron module that support currently 2 versions

{
  "versions": {
    "0.35.4": "github:koalabz/typed-electron/electron.d.ts#c597a7362eb4605ad737217a19b701d4cf2bc80a",
    "0.36.0": "github:koalabz/typed-electron/electron.d.ts#2689b1648190d6921496a3f94c0d4e1ecae2ef1f"
  }
}

but i don't understand where i need to create the electron.json file. In ambient or npmfolder ?

Maintainers

If you're interested in helping out to merge type definitions, please let me know ๐Ÿ˜„ I'd love to add some collaborators to the registry to merge definitions and offer helpful advice.

installing multiple dependencies does not work

Hi,

Trying to install multiple dependencies at the same time doesn't seem to work:
typings install jquery foundation-sites --save --ambient

only installs the first, jquery

You probably now that already, just checking :)

Grtz

cucumber

The type def in DefinitelyTyped is out of date. Need a new one!

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.