Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
flow-bin
Advanced tools
Package description
The flow-bin npm package provides a command-line interface for Flow, a static type checker for JavaScript. Flow helps developers catch common errors early by adding type annotations to JavaScript code.
Type Checking
Flow can be used to add type annotations to JavaScript functions and variables, which helps catch type errors during development.
/* @flow */
function add(a: number, b: number): number {
return a + b;
}
add(1, 2); // No error
add('1', '2'); // Error: string is incompatible with number
Type Inference
Flow can infer types even if they are not explicitly annotated, providing type safety without requiring extensive type annotations.
/* @flow */
function square(n) {
return n * n;
}
square(2); // No error
square('2'); // Error: string is incompatible with number
Type Definitions
Flow allows you to import and use type definitions from other files, making it easier to manage and reuse types across a project.
/* @flow */
import type { User } from './types';
function getUser(id: number): User {
// Implementation
}
TypeScript is a popular static type checker for JavaScript developed by Microsoft. It offers a superset of JavaScript with optional static types, and it has a large ecosystem and community support. Unlike Flow, TypeScript requires a compilation step to convert TypeScript code into JavaScript.
PropTypes is a library for runtime type checking of React props. It is less comprehensive than Flow or TypeScript as it only checks types at runtime and is specifically designed for React components. It does not provide the same level of static analysis and type inference as Flow.
ESLint plugin for Flow type annotations. It provides linting rules for Flow type annotations, helping to enforce consistent style and catch potential issues. It complements Flow by integrating type checking into the ESLint workflow.
Readme
Binary wrapper for Flow - A static type checker for JavaScript
macOS (x64), Linux (x64, arm64) and Windows (x64) binaries are currently provided.
For Yarn:
$ yarn add --dev flow-bin
$ yarn run flow --help
For npm, add { "scripts": { "flow": "flow" } }
in package.json and run:
$ npm install --save-dev flow-bin
$ npm run flow --help
$ npm install --save flow-bin
const execFile = require('child_process').execFile;
const flow = require('flow-bin');
execFile(flow, ['check'], (err, stdout) => {
console.log(stdout);
});
flow-bin is MIT-licensed.
make push VERSION=0.122.0
(use the same version as Flow)make publish
(run npm adduser
the first time to log in)npm pack
tar xf "flow-bin-$(node -p 'require("./package.json").version').tgz"
cd package
npm run verify
FAQs
Binary wrapper for Flow - A static type checker for JavaScript
The npm package flow-bin receives a total of 266,978 weekly downloads. As such, flow-bin popularity was classified as popular.
We found that flow-bin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.