Convert Figma logo to code with AI

typings logotypings

*DEPRECATED* The TypeScript Definition Manager

3,374
262
3,374
81

Top Related Projects

The repository for high quality TypeScript type definitions.

103,639

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

A central repository for Flow library definitions

1,282

Deno to npm package build tool.

Quick Overview

Typings is a TypeScript definition manager for JavaScript. It allows developers to easily install and manage TypeScript definition files for various JavaScript libraries, enabling better type checking and autocompletion in TypeScript projects that use external JavaScript dependencies.

Pros

  • Simplifies the process of adding type definitions to TypeScript projects
  • Supports a wide range of JavaScript libraries and frameworks
  • Allows for versioning of type definitions, ensuring compatibility with specific library versions
  • Integrates well with popular package managers like npm

Cons

  • The project is now deprecated in favor of npm @types packages
  • May require additional setup and configuration compared to using @types directly
  • Some definitions may be outdated or incomplete, depending on community contributions
  • Learning curve for users new to TypeScript or type definition management

Getting Started

To use Typings (note that it's deprecated, and @types is now recommended):

  1. Install Typings globally:
npm install -g typings
  1. Initialize Typings in your project:
typings init
  1. Install type definitions for a library (e.g., lodash):
typings install dt~lodash --global --save
  1. Reference the installed definitions in your TypeScript file:
/// <reference path="typings/index.d.ts" />
import * as _ from 'lodash';

Remember that using @types packages with npm is now the recommended approach for managing TypeScript definitions.

Competitor Comparisons

The repository for high quality TypeScript type definitions.

Pros of DefinitelyTyped

  • Larger community and more contributors, leading to better maintenance and updates
  • Official support from Microsoft and TypeScript team
  • More comprehensive coverage of libraries and frameworks

Cons of DefinitelyTyped

  • Can be overwhelming for beginners due to its size and complexity
  • Slower review process for new type definitions due to high volume of contributions

Code Comparison

DefinitelyTyped:

// @types/lodash/index.d.ts
declare module "lodash" {
    function chunk<T>(array: List<T>, size?: number): T[][];
    function compact<T>(array: List<T>): T[];
    // ... more definitions
}

Typings:

// typings/lodash/index.d.ts
declare module "lodash" {
    function chunk<T>(array: Array<T>, size?: number): T[][];
    function compact<T>(array: Array<T>): T[];
    // ... more definitions
}

The code structure is similar, but DefinitelyTyped tends to use more advanced TypeScript features and has more extensive type definitions. Typings often provides simpler, more basic type definitions.

DefinitelyTyped is now the standard for TypeScript type definitions, while Typings is no longer actively maintained. Most developers and projects have migrated to using DefinitelyTyped and the @types ecosystem for managing type definitions in TypeScript projects.

103,639

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

Pros of TypeScript

  • Official Microsoft project with extensive resources and support
  • Integrated development environment (IDE) with built-in TypeScript support
  • Continuous updates and improvements to the language specification

Cons of TypeScript

  • Steeper learning curve for developers new to static typing
  • Requires compilation step, which can slow down development process

Code Comparison

TypeScript:

interface User {
  name: string;
  age: number;
}

function greet(user: User) {
  console.log(`Hello, ${user.name}!`);
}

Typings:

// @flow
type User = {
  name: string,
  age: number
};

function greet(user: User) {
  console.log(`Hello, ${user.name}!`);
}

Key Differences

  • TypeScript is a superset of JavaScript, while Typings focuses on type definitions
  • TypeScript provides a more comprehensive ecosystem and tooling
  • Typings allows for gradual adoption of typing in existing JavaScript projects

Use Cases

  • TypeScript: Large-scale applications, enterprise projects
  • Typings: Adding type checking to existing JavaScript codebases, smaller projects

Community and Ecosystem

  • TypeScript has a larger community and more third-party library support
  • Typings is more focused on providing type definitions for existing JavaScript libraries

A central repository for Flow library definitions

Pros of flow-typed

  • Specifically designed for Flow, providing more accurate type definitions
  • Includes versioning support for library definitions
  • Community-driven with a focus on high-quality, well-maintained type definitions

Cons of flow-typed

  • Limited to Flow type system, not usable with TypeScript
  • Smaller ecosystem compared to typings, with fewer available definitions
  • Requires Flow to be set up in the project to use the definitions

Code Comparison

flow-typed:

// @flow
import type { Express } from 'express';
const app: Express = express();

typings:

/// <reference path="typings/index.d.ts" />
import * as express from 'express';
const app: express.Express = express();

Additional Notes

Both flow-typed and typings aim to provide type definitions for JavaScript libraries, but they cater to different type systems. flow-typed is specifically for Flow, while typings was primarily used for TypeScript (though it's now deprecated in favor of @types).

flow-typed focuses on maintaining a centralized repository of high-quality Flow type definitions, while typings had a broader scope and allowed for multiple definition sources.

The usage patterns differ slightly, with flow-typed integrating more seamlessly into Flow projects, and typings requiring explicit reference paths in TypeScript projects.

1,282

Deno to npm package build tool.

Pros of dnt

  • Designed specifically for Deno, offering seamless integration with the Deno ecosystem
  • Supports modern ECMAScript features and TypeScript out of the box
  • Provides a streamlined build process for creating Node.js and npm-compatible packages

Cons of dnt

  • Limited to Deno-to-Node.js conversions, less versatile than Typings
  • Smaller community and ecosystem compared to Typings
  • May require additional configuration for complex projects

Code Comparison

dnt:

import { build } from "https://deno.land/x/dnt/mod.ts";

await build({
  entryPoints: ["./mod.ts"],
  outDir: "./npm",
  package: { name: "my-library", version: "1.0.0" },
});

Typings:

import * as typings from "typings";

typings.install({
  name: "lodash",
  source: "npm",
  version: "4.17.21"
});

Key Differences

  • dnt focuses on building Deno modules for Node.js compatibility
  • Typings is a type definition manager for various JavaScript libraries
  • dnt is more suited for Deno developers looking to publish their packages for Node.js
  • Typings has broader language and platform support, including older JavaScript versions

Use Cases

  • Choose dnt for Deno-to-Node.js package conversions
  • Opt for Typings when working with multiple JavaScript libraries and need type definitions

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Typings

NPM version NPM downloads Build status Gitter

The TypeScript Definition Manager.

Deprecation Notice: Regarding TypeScript@2.0

For users doing typings install dt~<package> --global and receiving errors.

Starting from TypeScript 2.0, users can install typings using npm install @types/<package>. These typings are coming from DefinitelyTyped. In the future, we hope redirects will be enabled to support existing maintainers to contribute effectively to NPM's @types as they did to typings/registry.

Typings on DefinitelyTyped have also moved to the external module format supported by TypeScript. This finally solved the real problem that Typings was trying to solve! It also means it will cause errors such as:

> typings install dt~angular --global 

typings ERR! message Attempted to compile "angular" as a global module,
but it looks like an external module. You'll need to remove the global option to continue.

To resolve this, we recommend moving to TypeScript 2.0's official aquisition method (npm install @types/angular). You can also drop the --global flag from typings, though some definitions on DefinitelyTyped may not work with the Typings approach because of new TypeScript features (namely UMD namespaces).

This project will remain operational for the foreseeable future, but is effectively deprecated. New projects should use @types from NPM.

Quick Start

# Install Typings CLI utility.
npm install typings --global

# Search for definitions.
typings search tape

# Find a definition by name.
typings search --name react

# If you use the package as a module:
# Install non-global typings (defaults to "npm" source, configurable through `defaultSource` in `.typingsrc`).
typings install debug --save

# If you use the package through `<script>`, it is part of the environment, or
# the module typings are not yet available, try searching and installing with `--global`:
typings install dt~mocha --global --save

# If you need a specific commit from github.
typings install d3=github:DefinitelyTyped/DefinitelyTyped/d3/d3.d.ts#1c05872e7811235f43780b8b596bfd26fe8e7760 --global --save

# Search and install by version.
typings info env~node --versions
typings install env~node@0.10 --global --save

# Install typings from a particular source (use `<source>~<name>` or `--source <source>`).
typings install env~atom --global --save
typings install bluebird --source npm --save

# Use `typings/index.d.ts` (in `tsconfig.json` or as a `///` reference).
cat typings/index.d.ts

Usage

Typings is the simple way to manage and install TypeScript definitions. It uses typings.json, which can resolve to the Typings Registry, GitHub, NPM, Bower, HTTP and local files. Packages can use type definitions from various sources and different versions, knowing they will never conflict for users.

typings install debug --save

The public registry is maintained by the community, and is used to resolve official type definitions for JavaScript packages.

Read More

Sources

  • npm - dependencies from NPM
  • github - dependencies directly from GitHub (E.g. Duo, JSPM)
  • bitbucket - dependencies directly from Bitbucket
  • jspm: - dependencies from installed JSPM packages with typings distributed. Requires jspm@0.17+.
  • bower - dependencies from Bower
  • common - "standard" libraries without a known "source"
  • shared - shared library functionality
  • lib - shared environment functionality (mirror of shared) (--global)
  • env - environments (E.g. atom, electron) (--global)
  • global - global (window.<var>) libraries (--global)
  • dt - typings from DefinitelyTyped (usually --global)

Contributing

# Installation
# Fork this repo (https://github.com/typings/typings)
# Clone the fork (E.g. `https://github.com/<your_username>/typings.git`)
cd typings

# Install modules
npm install

# Build
npm run build

# Test
npm run test

Change Log

License

MIT

NPM DownloadsLast 30 Days