Skip to content

Commit

Permalink
Merge branch 'master' of github.com:flow-typed/flow-typed into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Brianzchen committed Oct 12, 2023
2 parents fc977f4 + 5f92108 commit a9e64a2
Show file tree
Hide file tree
Showing 15 changed files with 1,738 additions and 92 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '14', '16' ]
node: [ 'lts/*', 'current' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Before Install
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

---

## We're migrating our mainline from `master` to `main`
## ⚠️ Version 4.0 will release soon! ⚠️

And with that comes new features, most notably the support for **definition dependencies**.
And with it comes new features, most notably the support for **definition dependencies**.

Learn how to add dependencies to a definition from the `main` branch [docs](https://github.com/flow-typed/flow-typed/blob/main/CONTRIBUTING.md#importing-types-from-other-libdefs) which can be consumed with the `v4` CLI.

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Reporting a Vulnerability

Please report (suspected) security vulnerabilities to [flowtyped@gmail.com](mailto:flowtyped@gmail.com).
Please report (suspected) security vulnerabilities to [security@flowtyped.fastmail.com](mailto:security@flowtyped.fastmail.com).
If you do not receive a response within 48 hours, contact a flow-typed team member on the
[Flow Discord](https://discord.gg/e6p4b2q3eD) server. If the issue is confirmed, we will release a
patch as soon as possible, depending on its complexity.
1 change: 1 addition & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"version": "4.0.0-3",
"main": "dist/cli.js",
"bin": "dist/cli.js",
"packageManager": "yarn@1.22.19",
"engines": {
"node": ">=10.0.0"
},
Expand Down
20 changes: 3 additions & 17 deletions cli/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2103,21 +2103,7 @@ data-urls@^2.0.0:
whatwg-mimetype "^2.3.0"
whatwg-url "^8.0.0"

debug@4, debug@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
dependencies:
ms "2.1.2"

debug@^4.1.0, debug@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==
dependencies:
ms "^2.1.1"

debug@^4.3.4:
debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
Expand Down Expand Up @@ -3605,7 +3591,7 @@ mkdirp@^1.0.3:
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.3.tgz#4cf2e30ad45959dddea53ad97d518b6c8205e1ea"
integrity sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==

ms@2.1.2, ms@^2.1.1:
ms@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
Expand Down Expand Up @@ -4079,7 +4065,7 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==

semver@^7.5.4, semver@^7.2.1, semver@^7.3.2:
semver@^7.2.1, semver@^7.3.2, semver@^7.5.4:
version "7.5.4"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
Expand Down
34 changes: 20 additions & 14 deletions definitions/environments/node/flow_v0.155.x-/node.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
// https://nodejs.org/api/fs.html#promises-api
// https://nodejs.org/api/esm.html#node-imports

declare module 'fs/promises' {
declare module.exports: $Exports<'fs'>['promises'];
declare module 'node:assert' {
declare module.exports: $Exports<'assert'>;
}

declare module 'process' {
declare module.exports: Process;
declare module 'node:assert/strict' {
declare module.exports: $Exports<'assert'>['strict'];
}

declare module 'node:process' {
declare module.exports: $Exports<'process'>;
}

// https://nodejs.org/api/esm.html#node-imports

declare module 'node:events' {
declare module.exports: $Exports<'events'>;
}
Expand All @@ -22,18 +16,30 @@ declare module 'node:fs' {
declare module.exports: $Exports<'fs'>;
}

declare module 'node:fs/promises' {
declare module 'node:os' {
declare module.exports: $Exports<'os'>;
}

declare module 'fs/promises' {
declare module.exports: $Exports<'fs'>['promises'];
}

declare module 'node:os' {
declare module.exports: $Exports<'os'>;
declare module 'node:fs/promises' {
declare module.exports: $Exports<'fs'>['promises'];
}

declare module 'node:path' {
declare module.exports: $Exports<'path'>;
}

declare module 'process' {
declare module.exports: Process;
}

declare module 'node:process' {
declare module.exports: $Exports<'process'>;
}

declare module 'node:util' {
declare module.exports: $Exports<'util'>;
}
Expand Down
15 changes: 15 additions & 0 deletions definitions/environments/node/flow_v0.155.x-/test_node.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// @flow
import { describe, it } from 'flow-typed-test';

import assert from 'assert';
import events from 'events';
import fs from 'fs';
import os from 'os';
import path from 'path';
import util from 'util';
import url from 'url';

import nodeAssert from 'node:assert';
import nodeAssertStrict from 'node:assert/strict';
import nodeEvents from 'node:events';
import fsPromises from 'fs/promises';
import importProcess from 'process';
Expand All @@ -20,6 +23,18 @@ import nodeUtil from 'node:util';
import nodeUrl from 'node:url';

describe('node', () => {
describe('node:assert', () => {
it('should retrieve the corresponding Flow core types', () => {
(nodeAssert.equal: typeof assert.equal);
});
});

describe('node:assert/strict', () => {
it('should retrieve the corresponding Flow core types', () => {
(nodeAssertStrict.equal: typeof assert.strict.equal);
});
});

describe('node:events', () => {
it('should retrieve the corresponding Flow core types', () => {
(nodeEvents.EventEmitter: typeof events.EventEmitter);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
declare module 'body-scroll-lock' {
declare type BodyScrollOptions = {|
reserveScrollBarGap?: boolean,
allowTouchMove?: (el: any) => boolean,
|}

declare type BodyScrollLock = {|
disableBodyScroll: (target: HTMLElement, options?: BodyScrollOptions) => void,
enableBodyScroll: (target: HTMLElement) => void,
clearAllBodyScrollLocks: () => void,
|};

declare module.exports: BodyScrollLock;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// @flow
import { describe, it } from 'flow-typed-test';
import {
disableBodyScroll,
enableBodyScroll,
clearAllBodyScrollLocks,
} from 'body-scroll-lock';

declare var element: HTMLElement;
declare var inputElement: HTMLInputElement;

describe('body-scroll-lock', () => {
it('disableBodyScroll', () => {
(disableBodyScroll(element): void);
disableBodyScroll(inputElement);
// $FlowExpectedError[incompatible-call]
disableBodyScroll();
});

it('disableBodyScroll with options', () => {
disableBodyScroll(element, {
reserveScrollBarGap: true,
allowTouchMove: (el) => true,
});
disableBodyScroll(element, {
reserveScrollBarGap: true,
});
disableBodyScroll(element, {
allowTouchMove: (el) => true,
});
// $FlowExpectedError[prop-missing]
disableBodyScroll(element, {
random: true,
});
});

it('enableBodyScroll', () => {
(enableBodyScroll(element): void);
enableBodyScroll(inputElement);
// $FlowExpectedError[incompatible-call]
enableBodyScroll();
// $FlowExpectedError[extra-arg]
enableBodyScroll(element, {});
});

it('clearAllBodyScrollLocks', () => {
(clearAllBodyScrollLocks(): void);
// $FlowExpectedError[extra-arg]
clearAllBodyScrollLocks('');
});
});

0 comments on commit a9e64a2

Please sign in to comment.