Skip to content

Commit 4e56161

Browse files
committed
[New] add types
1 parent d8d42b6 commit 4e56161

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+980
-160
lines changed

.eslintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
"no-underscore-dangle": "warn",
2424
"object-curly-newline": "off",
2525
"sort-keys": "off",
26+
27+
"no-extra-parens": "off",
2628
},
2729
"ignorePatterns": ["syntax-error.*"],
2830
"overrides": [

.github/workflows/node-aught.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ jobs:
99
range: '< 10'
1010
type: minors
1111
command: npm run tests-only
12+
skip-ls-check: true

bin/import-or-require.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const { extname: extnamePath } = require('path');
44
const { pathToFileURL } = require('url');
55
const getPackageType = require('get-package-type');
66

7+
/** @type {(file: string) => undefined | Promise<unknown>} */
78
// eslint-disable-next-line consistent-return
89
module.exports = function importOrRequire(file) {
910
const ext = extnamePath(file);

bin/tape

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ var hasImport = require('has-dynamic-import');
100100

101101
var tape = require('../');
102102

103+
/** @type {(hasSupport: boolean) => Promise<void> | void} */
103104
function importFiles(hasSupport) {
104105
tape.wait();
105106

107+
/** @type {null | undefined | Promise<unknown>} */
106108
var filesPromise;
107109
if (hasSupport) {
108110
var importOrRequire = require('./import-or-require');

example/array.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ test('array', function (t) {
2626
];
2727

2828
Function('fn', 'g', String(output))(
29-
function (xs) {
29+
/** @param {number[]} xs */ function (xs) {
3030
t.same(arrays.shift(), xs);
3131
return xs;
3232
},
33-
function (xs) {
33+
/** @param {number[]} xs */ function (xs) {
3434
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
3535
}
3636
);

example/fail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ test('array', function (t) {
2626
];
2727

2828
Function('fn', 'g', String(output))(
29-
function (xs) {
29+
/** @param {number[]} xs */ function (xs) {
3030
t.same(arrays.shift(), xs);
3131
return xs;
3232
},
33-
function (xs) {
33+
/** @param {number[]} xs */ function (xs) {
3434
t.same(xs, [[1, 2, [3, 4444]], [5, 6]]);
3535
}
3636
);

example/nested.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ test('nested array test', function (t) {
3535
];
3636

3737
Function('fn', 'g', String(output))(
38-
function (xs) {
38+
/** @param {number[]} xs */ function (xs) {
3939
t.same(arrays.shift(), xs);
4040
return xs;
4141
},
42-
function (xs) {
42+
/** @param {number[]} xs */ function (xs) {
4343
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
4444
}
4545
);

example/nested_fail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ test('nested array test', function (t) {
3535
];
3636

3737
Function('fn', 'g', String(output))(
38-
function (xs) {
38+
/** @param {number[]} xs */ function (xs) {
3939
t.same(arrays.shift(), xs);
4040
return xs;
4141
},
42-
function (xs) {
42+
/** @param {number[]} xs */ function (xs) {
4343
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
4444
}
4545
);

example/not_enough_fail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ test('array', function (t) {
2626
];
2727

2828
Function('fn', 'g', String(output))(
29-
function (xs) {
29+
/** @param {number[]} xs */ function (xs) {
3030
t.same(arrays.shift(), xs);
3131
return xs;
3232
},
33-
function (xs) {
33+
/** @param {number[]} xs */ function (xs) {
3434
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
3535
}
3636
);

example/too_many_fail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ test('array', function (t) {
2626
];
2727

2828
Function('fn', 'g', String(output))(
29-
function (xs) {
29+
/** @param {number[]} xs */ function (xs) {
3030
t.same(arrays.shift(), xs);
3131
return xs;
3232
},
33-
function (xs) {
33+
/** @param {number[]} xs */ function (xs) {
3434
t.same(xs, [[1, 2, [3, 4]], [5, 6]]);
3535
}
3636
);

0 commit comments

Comments
 (0)