Convert Figma logo to code with AI

flow-typed logoflow-typed

A central repository for Flow library definitions

3,767
1,330
3,767
236

Top Related Projects

The repository for high quality TypeScript type definitions.

100,112

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

22,078

Adds static typing to JavaScript to improve developer productivity and code quality.

3,380

*DEPRECATED* The TypeScript Definition Manager

6,692

Runtime type system for IO decoding/encoding

Quick Overview

The flow-typed repository is a community-driven repository of third-party library interface definitions for the Flow type checker. It provides a centralized location for developers to find and contribute type definitions for popular JavaScript libraries, making it easier to use Flow with a wide range of external dependencies.

Pros

  • Centralized Type Definitions: The repository serves as a hub for finding and sharing type definitions, reducing the need for developers to create and maintain their own type definitions.
  • Improved Type Safety: By using the type definitions from the flow-typed repository, developers can benefit from improved type safety and catch more errors during development.
  • Community Collaboration: The project encourages community involvement, with contributors adding new type definitions and maintaining existing ones.
  • Supports a Wide Range of Libraries: The repository covers a large and growing number of popular JavaScript libraries, making it a valuable resource for Flow users.

Cons

  • Potential Outdated Definitions: As the JavaScript ecosystem evolves, some type definitions in the repository may become outdated and require updates.
  • Dependency on Community Contributions: The project's success relies on the continued contributions and maintenance efforts of the community, which can be a potential limitation.
  • Versioning Challenges: Keeping type definitions up-to-date with the latest library versions can be a challenge, as it requires ongoing maintenance.
  • Limited Coverage for Niche Libraries: While the repository covers many popular libraries, it may not have type definitions for more obscure or specialized libraries.

Getting Started

To use the flow-typed repository, follow these steps:

  1. Install the flow-typed CLI tool:
npm install -g flow-typed
  1. Search for and install the type definitions for your project's dependencies:
flow-typed install

This will download the appropriate type definitions for your project's dependencies and place them in the flow-typed/ directory.

  1. If you need to install a specific version of a type definition, you can use the following command:
flow-typed install <library>@<version>
  1. To create a new type definition, you can use the flow-typed create-stub command:
flow-typed create-stub <library>@<version>

This will generate a stub type definition file that you can then customize and submit as a pull request to the flow-typed repository.

Competitor Comparisons

The repository for high quality TypeScript type definitions.

Pros of DefinitelyTyped

  • Larger community and more contributors, resulting in a wider range of type definitions
  • Better integration with TypeScript ecosystem and tooling
  • More frequent updates and maintenance due to its popularity

Cons of DefinitelyTyped

  • Can be overwhelming for newcomers due to its size and complexity
  • Slower review process for new contributions due to high volume of submissions

Code Comparison

DefinitelyTyped (TypeScript):

declare module 'example-module' {
  export function doSomething(value: string): number;
  export interface Options {
    flag: boolean;
  }
}

flow-typed (Flow):

declare module 'example-module' {
  declare export function doSomething(value: string): number;
  declare export interface Options {
    flag: boolean;
  }
}

The main difference in the code is the use of the declare keyword in flow-typed, which is required for Flow type definitions. TypeScript doesn't need this keyword for ambient declarations.

DefinitelyTyped is more widely used and has better tooling support, making it a popular choice for TypeScript projects. However, flow-typed serves a similar purpose for Flow users and may be more suitable for projects already using Flow for type checking.

100,112

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

Pros of TypeScript

  • Larger ecosystem and community support
  • More comprehensive language features and tooling
  • Better integration with popular IDEs and editors

Cons of TypeScript

  • Steeper learning curve for developers new to static typing
  • Potentially longer compilation times for large projects
  • Some JavaScript libraries may lack TypeScript definitions

Code Comparison

TypeScript:

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

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

Flow (with flow-typed):

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

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

While both TypeScript and flow-typed aim to add static typing to JavaScript, TypeScript offers a more comprehensive solution with broader adoption. Flow-typed focuses on providing type definitions for existing JavaScript libraries, whereas TypeScript includes its own type system and language features.

TypeScript's larger ecosystem and better tooling support make it a popular choice for many developers and organizations. However, flow-typed can be a lighter-weight option for projects that want to add type checking to existing JavaScript codebases without fully adopting TypeScript.

22,078

Adds static typing to JavaScript to improve developer productivity and code quality.

Pros of Flow

  • Developed and maintained by Facebook, ensuring robust support and regular updates
  • Provides static type checking for JavaScript, enhancing code quality and catching errors early
  • Integrates seamlessly with popular IDEs and text editors

Cons of Flow

  • Steeper learning curve compared to flow-typed
  • Requires more setup and configuration to get started
  • May have compatibility issues with certain third-party libraries

Code Comparison

Flow:

// @flow
function add(a: number, b: number): number {
  return a + b;
}

flow-typed:

// No explicit type annotations needed
function add(a, b) {
  return a + b;
}

Key Differences

  • Flow-typed focuses on providing type definitions for third-party libraries, while Flow is a complete static type checker
  • Flow-typed is community-driven, whereas Flow is maintained by Facebook
  • Flow-typed can be used alongside Flow to enhance its capabilities with additional type definitions

Use Cases

  • Use Flow for large-scale projects requiring comprehensive static type checking
  • Choose flow-typed when working with third-party libraries and need type definitions
  • Combine both for a robust typing system with extensive library support
3,380

*DEPRECATED* The TypeScript Definition Manager

Pros of typings

  • Supports multiple type definition sources (DefinitelyTyped, npm, GitHub)
  • Allows for version-specific type definitions
  • Provides a CLI tool for easy management of type definitions

Cons of typings

  • No longer actively maintained (last commit in 2018)
  • Limited to TypeScript type definitions
  • Requires manual installation and management of type definitions

Code comparison

typings:

typings install dt~jquery --global --save

flow-typed:

flow-typed install jquery@x.x.x

Additional notes

flow-typed is specifically designed for Flow, while typings was created for TypeScript. flow-typed is actively maintained and integrated with the Flow ecosystem, making it a more current solution for Flow users. typings, on the other hand, has been largely superseded by the @types organization on npm for TypeScript users.

Both tools aim to provide type definitions for third-party libraries, but they cater to different type systems and have different approaches to managing and distributing type definitions.

6,692

Runtime type system for IO decoding/encoding

Pros of io-ts

  • Runtime type checking, providing additional safety beyond compile-time checks
  • Seamless integration with TypeScript, allowing for type inference and validation
  • Supports complex types and custom validation logic

Cons of io-ts

  • Steeper learning curve due to its functional programming approach
  • Requires additional runtime overhead for type checking
  • Less extensive library of pre-defined types compared to flow-typed

Code Comparison

flow-typed example:

// @flow
function add(a: number, b: number): number {
  return a + b;
}

io-ts example:

import * as t from 'io-ts';

const AddFunction = t.type({
  a: t.number,
  b: t.number,
});

function add(params: t.TypeOf<typeof AddFunction>): number {
  return params.a + params.b;
}

Key Differences

  • flow-typed focuses on static type checking, while io-ts provides both static and runtime type checking
  • io-ts offers more flexibility in defining complex types and custom validations
  • flow-typed has a larger community-contributed library of type definitions for popular JavaScript packages

Use Cases

  • Choose flow-typed for projects requiring static type checking with minimal runtime overhead
  • Opt for io-ts when runtime type validation is crucial, especially in scenarios involving API integrations or user input handling

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

flow-typed

A repository of high-quality, third-party library type definitions for use with Flow.

ci status npm package docs discord package health

[!NOTE]
We want to keep the flow-typed community informed about the current state and future direction of the project. As you might have noticed, our activity has slowed down in recent months. However, we are committed to maintaining the functionality of flow-typed and will continue to fix any issues that arise with new releases of Flow.

While we're not planning any major new features at the moment, we remain open to feature contributions from the community. Our focus remains on ensuring that the existing features work well and that type definitions are kept up to date. We appreciate the value that these contributions bring and encourage anyone interested in enhancing flow-typed to get involved.

Check out the quick start page in the docs to get started. It will walk you through installing typedefs, using them, as well as writing and including your own.

Huh?

When you start a project with Flow, you likely want to use some third-party libraries that were not written with Flow. By default, Flow will just ignore these libraries leaving them untyped. As a result, Flow can't give errors if you accidentally mis-use the library (nor will it be able to auto-complete the library).

To address this, Flow supports library definitions which allow you to describe the interface of a module or library separate from the implementation of that module/library.

The flow-typed repo is a collection of high-quality library definitions, tests to ensure that definitions remain high quality, and tooling to make it as easy as possible to import them into your project.

All you have to do when you add one or more new dependencies to your project is run flow-typed install. This will search the libdef repo and download all the libdefs that are relevant for your project and install them for you. After that, simply check them in and be on your way!

The CLI

The flow-typed npm package provides a CLI that includes several commands for working with this repository. The full list of commands is available in the docs .

FAQs

Before opening an issue, take a look at the FAQs. Chances are your question has already been answered! If not, don't hesitate to open an issue.

How Do I Contribute Library Definitions?

Just send a pull request! The documentation highlighted in CONTRIBUTING.md should give a detailed overview of how to raise a pull request following our best practices.

Contributing to the CLI

Bugfixes and improvements to the core CLI are welcome. If you'd like to contribute a new feature, consider opening an issue first to discuss it.

Active Maintenance Team

Andrew SmithBrian ChenGeorges-Antoine AssiPascal DuezVille Saukkonen
@AndrewSouthpaw@Brianzchen@GAntoine@pascalduez@villesau

NPM DownloadsLast 30 Days