From 0637a25f552520490e9025d559cf384043d6e93f Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Thu, 22 Jul 2021 15:31:39 -0500 Subject: [PATCH] Update to TypeScript v4.3.5 (#332) * chore(typescript): update to TypeScript 4.3.5 Update to TypeScript 4.3.5. Also required updating eslint and closure-compiler. fix #331 * chore(closure-compiler): remove @export comment that breaks newest closure-compiler --- .eslintrc.js | 419 ++++-------------- .vscode/launch.json | 67 ++- gulp/closure-task.js | 10 +- gulp/compile-task.js | 12 +- gulp/minify-task.js | 103 ----- gulp/test-task.js | 23 +- gulp/util.js | 24 +- jest.config.js | 5 +- jestconfigs/jest.es2015.cjs.config.js | 5 +- jestconfigs/jest.es2015.esm.config.js | 5 +- jestconfigs/jest.es2015.umd.config.js | 3 +- jestconfigs/jest.es5.cjs.config.js | 5 +- jestconfigs/jest.es5.esm.config.js | 5 +- jestconfigs/jest.es5.umd.config.js | 5 +- jestconfigs/jest.esnext.cjs.config.js | 5 +- jestconfigs/jest.esnext.esm.config.js | 5 +- jestconfigs/jest.esnext.umd.config.js | 3 +- jestconfigs/jest.ix.config.js | 5 +- jestconfigs/jest.src.config.js | 1 + jestconfigs/jest.ts.config.js | 5 +- package.json | 11 +- .../catcherror-spec.ts | 4 +- spec/asynciterable-operators/debounce-spec.ts | 10 +- .../defaultifempty-spec.ts | 6 +- spec/asynciterable-operators/filter-spec.ts | 18 +- spec/asynciterable-operators/finalize-spec.ts | 6 +- spec/asynciterable-operators/flatmap-spec.ts | 18 +- .../asynciterable-operators/groupjoin-spec.ts | 30 +- .../asynciterable-operators/innerjoin-spec.ts | 30 +- spec/asynciterable-operators/memoize-spec.ts | 30 +- spec/asynciterable-operators/orderby-spec.ts | 18 +- spec/asynciterable-operators/publish-spec.ts | 12 +- spec/asynciterable-operators/retry-spec.ts | 6 +- spec/asynciterable-operators/reverse-spec.ts | 6 +- spec/asynciterable-operators/skip-spec.ts | 6 +- .../asynciterable-operators/skipwhile-spec.ts | 6 +- spec/asynciterable-operators/take-spec.ts | 6 +- .../asynciterable-operators/takewhile-spec.ts | 6 +- spec/asynciterable-operators/tap-spec.ts | 35 +- spec/asynciterable-operators/timeout-spec.ts | 6 +- spec/asynciterable/aborting-spec.ts | 4 +- spec/asynciterable/asyncify-spec.ts | 4 +- spec/asynciterable/asyncifyerrback-spec.ts | 12 +- spec/asynciterable/asyncsink-spec.ts | 14 +- spec/asynciterable/average-spec.ts | 12 +- spec/asynciterable/catcherror-spec.ts | 6 +- spec/asynciterable/count-spec.ts | 16 +- spec/asynciterable/elementat-spec.ts | 6 +- spec/asynciterable/every-spec.ts | 16 +- spec/asynciterable/first-spec.ts | 6 +- spec/asynciterable/forkjoin-spec.ts | 6 +- spec/asynciterable/from-spec.ts | 19 +- spec/asynciterable/fromdomstream-spec.ts | 4 +- spec/asynciterable/generate-spec.ts | 20 +- spec/asynciterable/generatetime-spec.ts | 26 +- spec/asynciterable/inference-spec.ts | 14 +- spec/asynciterable/last-spec.ts | 6 +- spec/asynciterable/max-spec.ts | 6 +- spec/asynciterable/maxby-spec.ts | 6 +- spec/asynciterable/min-spec.ts | 6 +- spec/asynciterable/minby-spec.ts | 6 +- spec/asynciterable/reduce-spec.ts | 8 +- spec/asynciterable/reduceright-spec.ts | 8 +- spec/asynciterable/sequenceequal-spec.ts | 30 +- spec/asynciterable/single-spec.ts | 18 +- spec/asynciterable/some-spec.ts | 16 +- spec/asynciterable/throw-spec.ts | 7 +- spec/asynciterable/toarray-spec.ts | 2 +- spec/asynciterable/tonodestream-spec.ts | 15 +- spec/asynciterable/zip-spec.ts | 14 +- spec/index.ts | 3 +- spec/iterable-operators/filter-spec.ts | 26 +- spec/iterable-operators/finally-spec.ts | 6 +- spec/iterable-operators/map-spec.ts | 2 +- spec/iterable-operators/tap-spec.ts | 4 +- spec/iterable/catcherror-spec.ts | 6 +- spec/iterable/elementat-spec.ts | 6 +- spec/iterable/first-spec.ts | 6 +- spec/iterable/from-spec.ts | 11 +- spec/iterable/inference-spec.ts | 14 +- spec/iterable/last-spec.ts | 6 +- spec/iterable/maxby-spec.ts | 6 +- spec/iterable/minby-spec.ts | 6 +- spec/iterable/repeatvalue-spec.ts | 12 +- spec/iterable/single-spec.ts | 6 +- spec/iterable/toarray-spec.ts | 2 +- spec/tsconfig.json | 1 + spec/tsconfig/tsconfig.base.json | 10 +- src/aborterror.ts | 2 +- src/add/asynciterable-operators/memoize.ts | 2 +- src/add/asynciterable-operators/repeat.ts | 2 +- src/add/asynciterable-operators/retry.ts | 2 +- src/add/iterable-operators/memoize.ts | 2 +- src/add/iterable-operators/reduce.ts | 6 +- src/add/iterable-operators/reduceright.ts | 6 +- src/add/iterable-operators/repeat.ts | 2 +- src/add/iterable-operators/retry.ts | 2 +- src/add/iterable-operators/scan.ts | 6 +- src/add/iterable-operators/scanright.ts | 6 +- src/asynciterable/as.ts | 4 - src/asynciterable/asasynciterable.ts | 22 +- src/asynciterable/asyncify.ts | 5 +- src/asynciterable/asyncifyerrback.ts | 3 +- src/asynciterable/asynciterablex.ts | 2 +- src/asynciterable/asyncsink.ts | 2 +- src/asynciterable/average.ts | 3 - src/asynciterable/catcherror.ts | 2 - src/asynciterable/combinelatest.ts | 6 - src/asynciterable/concat.ts | 6 - src/asynciterable/count.ts | 1 - src/asynciterable/create.ts | 1 - src/asynciterable/defer.ts | 1 - src/asynciterable/elementat.ts | 1 - src/asynciterable/empty.ts | 1 - src/asynciterable/every.ts | 1 - src/asynciterable/find.ts | 1 - src/asynciterable/findindex.ts | 1 - src/asynciterable/findoptions.ts | 2 - src/asynciterable/first.ts | 1 - src/asynciterable/forkjoin.ts | 14 - src/asynciterable/fromdomstream.ts | 52 +-- src/asynciterable/fromevent.ts | 9 +- src/asynciterable/fromeventpattern.ts | 1 - src/asynciterable/fromnodestream.ts | 1 - src/asynciterable/generate.ts | 1 - src/asynciterable/generatetime.ts | 1 - src/asynciterable/iif.ts | 1 - src/asynciterable/includes.ts | 3 +- src/asynciterable/interval.ts | 1 - src/asynciterable/isempty.ts | 1 - src/asynciterable/last.ts | 1 - src/asynciterable/mathoptions.ts | 1 - src/asynciterable/max.ts | 1 - src/asynciterable/maxby.ts | 1 - src/asynciterable/merge.ts | 6 - src/asynciterable/min.ts | 1 - src/asynciterable/minby.ts | 1 - src/asynciterable/never.ts | 1 - src/asynciterable/of.ts | 1 - src/asynciterable/onerrorresumenext.ts | 1 - src/asynciterable/operators/batch.ts | 3 +- src/asynciterable/operators/buffer.ts | 1 - .../operators/buffercountortime.ts | 1 - src/asynciterable/operators/catcherror.ts | 1 - .../operators/combinelatestwith.ts | 6 - src/asynciterable/operators/concatall.ts | 1 - src/asynciterable/operators/concatwith.ts | 6 - src/asynciterable/operators/debounce.ts | 3 +- src/asynciterable/operators/defaultifempty.ts | 1 - src/asynciterable/operators/delay.ts | 1 - src/asynciterable/operators/delayeach.ts | 1 - src/asynciterable/operators/distinct.ts | 1 - .../operators/distinctoptions.ts | 1 - .../operators/distinctuntilchanged.ts | 3 +- src/asynciterable/operators/dowhile.ts | 1 - src/asynciterable/operators/endwith.ts | 1 - src/asynciterable/operators/except.ts | 1 - src/asynciterable/operators/expand.ts | 1 - src/asynciterable/operators/filter.ts | 1 - src/asynciterable/operators/finalize.ts | 1 - src/asynciterable/operators/flat.ts | 3 +- src/asynciterable/operators/flatmap.ts | 1 - src/asynciterable/operators/groupby.ts | 3 +- src/asynciterable/operators/groupjoin.ts | 1 - src/asynciterable/operators/ignoreelements.ts | 1 - src/asynciterable/operators/innerjoin.ts | 1 - src/asynciterable/operators/intersect.ts | 1 - src/asynciterable/operators/map.ts | 1 - src/asynciterable/operators/memoize.ts | 17 +- src/asynciterable/operators/mergeall.ts | 1 - src/asynciterable/operators/mergewith.ts | 6 - src/asynciterable/operators/orderby.ts | 4 - src/asynciterable/operators/pairwise.ts | 1 - src/asynciterable/operators/pluck.ts | 1 - src/asynciterable/operators/publish.ts | 6 +- src/asynciterable/operators/racewith.ts | 1 - src/asynciterable/operators/repeat.ts | 3 +- src/asynciterable/operators/retry.ts | 3 +- src/asynciterable/operators/reverse.ts | 1 - src/asynciterable/operators/scan.ts | 1 - src/asynciterable/operators/scanoptions.ts | 1 - src/asynciterable/operators/scanright.ts | 1 - src/asynciterable/operators/share.ts | 15 +- src/asynciterable/operators/skip.ts | 1 - src/asynciterable/operators/skiplast.ts | 1 - src/asynciterable/operators/skipuntil.ts | 1 - src/asynciterable/operators/skipwhile.ts | 3 - src/asynciterable/operators/slice.ts | 3 +- src/asynciterable/operators/startwith.ts | 1 - src/asynciterable/operators/take.ts | 1 - src/asynciterable/operators/takelast.ts | 1 - src/asynciterable/operators/takeuntil.ts | 1 - src/asynciterable/operators/takewhile.ts | 3 - src/asynciterable/operators/tap.ts | 3 - src/asynciterable/operators/throttle.ts | 1 - src/asynciterable/operators/timeinterval.ts | 1 - src/asynciterable/operators/timeout.ts | 3 +- src/asynciterable/operators/timestamp.ts | 1 - src/asynciterable/operators/union.ts | 1 - src/asynciterable/operators/withabort.ts | 2 - src/asynciterable/operators/withlatestfrom.ts | 6 - src/asynciterable/operators/zipwith.ts | 6 - src/asynciterable/race.ts | 1 - src/asynciterable/range.ts | 1 - src/asynciterable/reduce.ts | 1 - src/asynciterable/reduceoptions.ts | 1 - src/asynciterable/reduceright.ts | 1 - src/asynciterable/repeatvalue.ts | 3 +- src/asynciterable/sequenceequal.ts | 1 - src/asynciterable/single.ts | 1 - src/asynciterable/some.ts | 1 - src/asynciterable/sum.ts | 3 - src/asynciterable/throwerrror.ts | 1 - src/asynciterable/toarray.ts | 1 - src/asynciterable/todomstream.ts | 45 +- src/asynciterable/tomap.ts | 1 - src/asynciterable/tonodestream.ts | 10 +- src/asynciterable/toobservable.ts | 3 +- src/asynciterable/toset.ts | 1 - src/asynciterable/whiledo.ts | 1 - src/asynciterable/zip.ts | 6 - src/iterable/as.ts | 4 - src/iterable/average.ts | 3 - src/iterable/concat.ts | 6 - src/iterable/count.ts | 1 - src/iterable/create.ts | 1 - src/iterable/defer.ts | 1 - src/iterable/elementat.ts | 1 - src/iterable/empty.ts | 1 - src/iterable/every.ts | 1 - src/iterable/find.ts | 1 - src/iterable/findindex.ts | 1 - src/iterable/findoptions.ts | 2 - src/iterable/first.ts | 1 - src/iterable/generate.ts | 1 - src/iterable/iif.ts | 1 - src/iterable/includes.ts | 3 +- src/iterable/isempty.ts | 1 - src/iterable/last.ts | 1 - src/iterable/mathoptions.ts | 1 - src/iterable/max.ts | 1 - src/iterable/maxby.ts | 1 - src/iterable/min.ts | 1 - src/iterable/minby.ts | 1 - src/iterable/of.ts | 1 - src/iterable/onerrorresumenext.ts | 1 - src/iterable/operators/_refcountlist.ts | 2 +- src/iterable/operators/catcherror.ts | 1 - src/iterable/operators/concatall.ts | 1 - src/iterable/operators/concatwith.ts | 6 - src/iterable/operators/defaultifempty.ts | 1 - src/iterable/operators/distinct.ts | 1 - src/iterable/operators/distinctoptions.ts | 1 - .../operators/distinctuntilchanged.ts | 1 - src/iterable/operators/dowhile.ts | 1 - src/iterable/operators/endwith.ts | 1 - src/iterable/operators/except.ts | 1 - src/iterable/operators/expand.ts | 1 - src/iterable/operators/filter.ts | 1 - src/iterable/operators/finalize.ts | 1 - src/iterable/operators/flat.ts | 3 +- src/iterable/operators/flatmap.ts | 1 - src/iterable/operators/groupby.ts | 3 +- src/iterable/operators/groupjoin.ts | 1 - src/iterable/operators/ignoreelements.ts | 1 - src/iterable/operators/innerjoin.ts | 1 - src/iterable/operators/intersect.ts | 1 - src/iterable/operators/map.ts | 1 - src/iterable/operators/memoize.ts | 13 +- src/iterable/operators/orderby.ts | 4 - src/iterable/operators/pairwise.ts | 1 - src/iterable/operators/pluck.ts | 1 - src/iterable/operators/publish.ts | 5 +- src/iterable/operators/repeat.ts | 3 +- src/iterable/operators/retry.ts | 3 +- src/iterable/operators/reverse.ts | 1 - src/iterable/operators/scan.ts | 7 +- src/iterable/operators/scanoptions.ts | 1 - src/iterable/operators/scanright.ts | 7 +- src/iterable/operators/share.ts | 3 - src/iterable/operators/skip.ts | 1 - src/iterable/operators/skiplast.ts | 1 - src/iterable/operators/skipwhile.ts | 3 - src/iterable/operators/slice.ts | 6 +- src/iterable/operators/startwith.ts | 1 - src/iterable/operators/take.ts | 1 - src/iterable/operators/takelast.ts | 1 - src/iterable/operators/takewhile.ts | 3 - src/iterable/operators/tap.ts | 3 - src/iterable/operators/union.ts | 1 - src/iterable/operators/zipwith.ts | 6 - src/iterable/range.ts | 1 - src/iterable/reduce.ts | 7 +- src/iterable/reduceoptions.ts | 2 +- src/iterable/reduceright.ts | 7 +- src/iterable/repeatvalue.ts | 3 +- src/iterable/sequenceequal.ts | 1 - src/iterable/single.ts | 1 - src/iterable/some.ts | 1 - src/iterable/sum.ts | 3 - src/iterable/throwerror.ts | 1 - src/iterable/toarray.ts | 1 - src/iterable/todomstream.ts | 16 +- src/iterable/tomap.ts | 1 - src/iterable/tonodestream.ts | 4 +- src/iterable/toset.ts | 1 - src/iterable/whiledo.ts | 1 - src/iterable/zip.ts | 6 - src/util/isiterable.ts | 2 + tsconfig.json | 1 + tsconfig/tsconfig.base.json | 4 +- tsconfig/tsconfig.es2015.cls.json | 5 +- tsconfig/tsconfig.es5.cls.json | 5 +- tsconfig/tsconfig.esnext.cls.json | 5 +- 314 files changed, 596 insertions(+), 1517 deletions(-) delete mode 100644 gulp/minify-task.js diff --git a/.eslintrc.js b/.eslintrc.js index 21d88bf0..1f2a376d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,331 +1,92 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + module.exports = { - "env": { - "browser": true, - "es6": true, - "node": true - }, - "extends": [], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": [ "tsconfig.json", "spec/tsconfig.json" ], - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "indent": [ - 2, - 2 - ], - "quotes": [ - 2, - "single" - ], - "linebreak-style": [ - 2, - "unix" - ], - "semi": [ - 2, - "always" - ], - "no-console": [ - 0 - ], - "max-len": [ - "error", - { - "code": 150 - } - ], - "no-cond-assign": [ - 2, - "except-parens" - ], - "no-ex-assign": [ - 2 - ], - "curly": "error", - "max-depth": [ - 2, - 5 - ], - "complexity": [ - 1, - 8 - ], - "prefer-const": [ - 1 - ], - "no-trailing-spaces": "error", - "one-var": [ - 2, - "never" - ], - "key-spacing": [ - 2, - { - "beforeColon": false, - "afterColon": true - } - ], - "new-cap": [ - 0 - ], - "new-parens": [ - 2 - ], - "no-mixed-spaces-and-tabs": [ - 2 - ], - "no-multiple-empty-lines": "error", - "no-nested-ternary": [ - 2 - ], - "no-new-object": [ - 2 - ], - "no-spaced-func": [ - 2 - ], - "arrow-spacing": [ - 2, - { - "before": true, - "after": true - } - ], - "operator-assignment": [ - 2, - "always" - ], - "padded-blocks": [ - 2, - "never" - ], - "keyword-spacing": [ - 2, - { - "before": true, - "after": true - } - ], - "space-before-blocks": [ - 2, - "always" - ], - "space-before-function-paren": [ - 2, - { - "anonymous": "always", - "named": "never" - } - ], - "array-bracket-spacing": [ - 2, - "never" - ], - "computed-property-spacing": [ - 2, - "never" - ], - "space-infix-ops": [ - 2, - { - "int32Hint": true - } - ], - "space-unary-ops": [ - 2, - { - "words": true, - "nonwords": false - } - ], - "no-delete-var": [ - 2 - ], - "no-underscore-dangle": [ - 0 - ], - "no-shadow": [ - 2 - ], - "no-shadow-restricted-names": [ - 2 - ], - "no-undef-init": [ - 2 - ], - "no-use-before-define": ["error", { "functions": false, "classes": false }], - "yoda": [ - 2, - "never" - ], - "consistent-return": [ - 2 - ], - "spaced-line-comment": [ - 0 - ], - "strict": [ - 2, - "never" - ], - "eqeqeq": ["error", "smart"], - "guard-for-in": [ - 2 - ], - "no-alert": [ - 2 - ], - "no-caller": [ - 2 - ], - "no-labels": [ - 2 - ], - "no-eval": [ - 2 - ], - "no-fallthrough": [ - 2 - ], - "default-case": [ - 2 - ], - "no-iterator": [ - 2 - ], - "no-loop-func": [ - 2 - ], - "no-multi-str": [ - 2 - ], - "no-new": [ - 2 - ], - "no-param-reassign": [ - 2 - ], - "no-proto": [ - 2 - ], - "no-redeclare": "error", - "no-return-assign": [ - 2 - ], - "no-self-compare": [ - 2 - ], - "no-sequences": [ - 2 - ], - "vars-on-top": [ - 0 - ], - "wrap-iife": [ - 2, - "inside" - ], - "valid-typeof": [ - 2 - ], - "no-unexpected-multiline": [ - 2 - ], - "dot-location": [ - 2, - "property" - ], - "no-unreachable": [ - 2 - ], - "no-negated-in-lhs": [ - 2 - ], - "no-irregular-whitespace": [ - 2 - ], - "no-invalid-regexp": [ - 2 - ], - "no-func-assign": [ - 2 - ], - "no-extra-semi": [ - 2 - ], - "no-extra-boolean-cast": [ - 2 - ], - "no-empty": "error", - "no-duplicate-case": [ - 2 - ], - "no-dupe-keys": [ - 2 - ], - "no-dupe-args": [ - 2 - ], - "no-constant-condition": [ - 2 - ], - "comma-style": [ - 2, - "last" - ], - "no-lonely-if": [ - 2 - ], - "@typescript-eslint/class-name-casing": "error", - "@typescript-eslint/indent": [ - "error", - 2, - { - "FunctionDeclaration": { - "parameters": "first" - }, - "FunctionExpression": { - "parameters": "first" - } - } - ], - "@typescript-eslint/member-delimiter-style": [ - "error", - { - "multiline": { - "delimiter": "semi", - "requireLast": true - }, - "singleline": { - "delimiter": "semi", - "requireLast": false - } - } - ], - "@typescript-eslint/no-empty-function": "error", - "@typescript-eslint/no-require-imports": "error", - "@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": false }], - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/quotes": [ - "error", - "single", - { - "avoidEscape": true - } - ], - "@typescript-eslint/semi": [ - "error", - "always" - ], - "@typescript-eslint/type-annotation-spacing": "error", - "eol-last": "off", - "no-unused-expressions": "error", - "no-var": "error" - }, - "settings": {} + env: { + browser: true, + es6: true, + node: true, + }, + parser: "@typescript-eslint/parser", + parserOptions: { + project: "tsconfig.json", + sourceType: "module", + ecmaVersion: 2020, + }, + plugins: ["@typescript-eslint", "jest"], + extends: [ + "eslint:recommended", + "plugin:jest/recommended", + "plugin:jest/style", + "plugin:@typescript-eslint/recommended", + ], + rules: { + "@typescript-eslint/member-delimiter-style": [ + "error", + { + multiline: { + delimiter: "semi", + requireLast: true, + }, + singleline: { + delimiter: "semi", + requireLast: false, + }, + }, + ], + "@typescript-eslint/no-namespace": ["error", { "allowDeclarations": true }], + "@typescript-eslint/no-require-imports": "error", + "@typescript-eslint/no-var-requires": "off", // handled by rule above + "@typescript-eslint/quotes": [ + "error", + "single", + { + avoidEscape: true, + allowTemplateLiterals: true + }, + ], + "@typescript-eslint/semi": ["error", "always"], + "@typescript-eslint/type-annotation-spacing": "error", + "@typescript-eslint/indent": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-unused-expressions": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-misused-new": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-unused-vars": "off", // ts already takes care of this + "@typescript-eslint/no-this-alias": "off", + "require-yield": "off", + "no-prototype-builtins": "off", + "prefer-rest-params": "off", + "jest/expect-expect": "off", + + "prefer-const": ["error", { + "destructuring": "all" + }], + "curly": ["error", "multi-line"], + "brace-style": ["error", "1tbs", { "allowSingleLine": true }], + "eol-last": "error", + "no-multiple-empty-lines": "error", + "no-trailing-spaces": "error", + "no-var": "error", + "no-empty": "off", + "no-cond-assign": "off" + }, }; diff --git a/.vscode/launch.json b/.vscode/launch.json index 174b0c0b..02533a07 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,7 +12,8 @@ "args": [ "build", // Specify we want to debug the "src" target, which won't clean or build -- essentially a "dry-run" of the gulp build - "--target", "src" + "--target", + "src" ] }, { @@ -20,6 +21,7 @@ "request": "launch", "name": "Debug Unit Tests", "cwd": "${workspaceRoot}", + "console": "integratedTerminal", "program": "${workspaceFolder}/node_modules/.bin/jest", "skipFiles": [ "/**/*.js", @@ -27,26 +29,57 @@ ], "env": { "NODE_NO_WARNINGS": "1", - "READABLE_STREAM": "disable", "TEST_DOM_STREAMS": "true", "TEST_NODE_STREAMS": "true", - // Modify these environment variables to run tests on a specific compilation target + module format combo - // "TEST_TS_SOURCE": "true", - "TEST_TS_SOURCE": "false", - "TEST_TARGET": "es5", - "TEST_MODULE": "cjs" }, "args": [ - "-i", + "--verbose", + "-runInBand", "--no-cache", - "-c", "jestconfigs/jest.src.config.js", - // "-c", "jestconfigs/jest.es5.umd.config.js", - "spec/iterable/", - "spec/asynciterable/", - "spec/iterable-operators/", - "spec/asynciterable-operators/", - // "spec/asynciterable/toobservable-spec.ts" + "-c", "jestconfigs/jest.${input:TEST_TARGET}.config.js", + "${input:TEST_FILE}" ] } - ] -} \ No newline at end of file + ], + "inputs": [ + { + "type": "pickString", + "default": "src", + "id": "TEST_TARGET", + "options": [ + "src", + "ix", + "ts", + "es5.cjs", + "es5.esm", + "es5.umd", + "es2015.cjs", + "es2015.esm", + "es2015.umd", + "esnext.cjs", + "esnext.esm", + "esnext.umd", + ], + "description": "The JS version + Module format combination to test (or src to test source files)", + }, + { + "type": "command", + "id": "TEST_FILE", + "command": "shellCommand.execute", + "args": { + "cwd": "${workspaceFolder}", + "description": "Select a file to debug", + "command": "./node_modules/.bin/jest --listTests | sed -r \"s@$PWD/spec/@@g\"", + } + }, + { + "type": "command", + "id": "TEST_RUNTIME_ARGS", + "command": "shellCommand.execute", + "args": { + "useSingleResult": "true", + "command": "case \"${input:TEST_TARGET}\" in *cjs | *umd | ix) echo '';; *) echo '--experimental-vm-modules';; esac" + } + }, + ], +} diff --git a/gulp/closure-task.js b/gulp/closure-task.js index a2230201..f6d0be4a 100644 --- a/gulp/closure-task.js +++ b/gulp/closure-task.js @@ -74,7 +74,9 @@ const closureTask = ((cache) => memoizeTask(cache, async function closure(target `${src}/**/*.js` /* <-- then sources globs */ ], { base: `./` }), sourcemaps.init(), - closureCompiler(createClosureArgs(entry_point, entry, externsPath, getUMDExportName(entry))), + closureCompiler(createClosureArgs(target, entry_point, entry, externsPath, getUMDExportName(entry)), { + platform: ['native', 'java', 'javascript'] + }), // rename the sourcemaps from *.js.map files to *.min.js.map sourcemaps.write(`.`, { mapFile: (mapPath) => mapPath.replace(`.js.map`, `.${target}.min.js.map`) }), gulp.dest(out) @@ -82,7 +84,7 @@ const closureTask = ((cache) => memoizeTask(cache, async function closure(target } }))({}); -const createClosureArgs = (entry_point, output, externs, libraryName) => ({ +const createClosureArgs = (target, entry_point, output, externs, libraryName) => ({ externs, entry_point, third_party: true, @@ -97,8 +99,8 @@ const createClosureArgs = (entry_point, output, externs, libraryName) => ({ package_json_entry_names: `module,jsnext:main,main`, assume_function_wrapper: true, js_output_file: `${output}.js`, - language_in: gCCLanguageNames[`es2015`], - language_out: gCCLanguageNames[`esnext`], + language_in: gCCLanguageNames[`esnext`], + language_out: gCCLanguageNames[target], output_wrapper: `(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['${libraryName}'], factory) : diff --git a/gulp/compile-task.js b/gulp/compile-task.js index 97ccb487..afcefee2 100644 --- a/gulp/compile-task.js +++ b/gulp/compile-task.js @@ -19,18 +19,16 @@ const { npmPkgName } = require('./util'); const { memoizeTask } = require('./memoize-task'); const { empty: ObservableEmpty } = require('rxjs'); -const minifyTask = require('./minify-task'); const closureTask = require('./closure-task'); const typescriptTask = require('./typescript-task'); const { copyMainTask, copyTSTask } = require('./copy-main-task'); const compileTask = ((cache) => memoizeTask(cache, function compile(target, format, ...args) { - return target === `src` ? ObservableEmpty() - : target === npmPkgName ? copyMainTask(target, format, ...args)() - : target === `ts` ? copyTSTask(target, format, ...args)() - : format === `umd` ? target === `es5` ? closureTask(target, format, ...args)() - : minifyTask(target, format, ...args)() - : typescriptTask(target, format, ...args)(); + return target === `src` ? ObservableEmpty() + : target === npmPkgName ? copyMainTask(target, format, ...args)() + : target === `ts` ? copyTSTask(target, format, ...args)() + : format === `umd` ? closureTask(target, format, ...args)() + : typescriptTask(target, format, ...args)(); }))({}); module.exports = compileTask; diff --git a/gulp/minify-task.js b/gulp/minify-task.js deleted file mode 100644 index 907fe752..00000000 --- a/gulp/minify-task.js +++ /dev/null @@ -1,103 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -const { - targetDir, - mainExport, - getUMDExportName, - UMDSourceTargets, - terserLanguageNames, - shouldRunInChildProcess, - spawnGulpCommandInChildProcess, -} = require('./util'); - -const path = require('path'); -const webpack = require(`webpack`); -const { memoizeTask } = require('./memoize-task'); -const TerserPlugin = require(`terser-webpack-plugin`); -const { - ReplaySubject, - bindNodeCallback: ObservableBindNodeCallback, -} = require('rxjs'); - -const { takeLast, multicast, refCount } = require('rxjs/operators'); - -const minifyTask = ((cache, commonConfig) => memoizeTask(cache, function minifyJS(target, format) { - - if (shouldRunInChildProcess(target, format)) { - return spawnGulpCommandInChildProcess('compile', target, format); - } - - const sourceTarget = UMDSourceTargets[target]; - const out = targetDir(target, format), src = targetDir(sourceTarget, `cls`); - - const targetConfig = { ...commonConfig, - output: { ...commonConfig.output, - path: path.resolve(`./${out}`) } }; - - const webpackConfigs = [ - `${mainExport}.dom`, - `${mainExport}.dom.iterable`, - `${mainExport}.dom.asynciterable`, - `${mainExport}.dom.iterable.operators`, - `${mainExport}.dom.asynciterable.operators` - ].map((entry) => ({ - ...targetConfig, - name: entry, - output: { - ...targetConfig.output, - library: getUMDExportName(entry) - }, - entry: { [entry]: path.resolve(`${src}/${entry}.js`) }, - plugins: [ - ...(targetConfig.plugins || []), - new webpack.SourceMapDevToolPlugin({ - filename: `[name].${target}.min.js.map`, - moduleFilenameTemplate: ({ resourcePath }) => - resourcePath - .replace(/\s/, `_`) - .replace(/\.\/node_modules\//, ``) - }) - ], - optimization: { - minimize: true, - minimizer: [ - new TerserPlugin({ - sourceMap: true, - terserOptions: { - ecma: terserLanguageNames[target], - output: { comments: false, beautify: false }, - compress: { unsafe: true }, - mangle: true, - safari10: true // <-- works around safari10 bugs, see the "safari10" option here: https://github.com/terser-js/terser#minify-options - }, - }) - ] - } - })); - - const compilers = webpack(webpackConfigs); - return ObservableBindNodeCallback(compilers.run.bind(compilers))() - .pipe(takeLast(1), multicast(new ReplaySubject()), refCount()) -}))({}, { - resolve: { mainFields: [`module`, `main`] }, - module: { rules: [{ test: /\.js$/, enforce: `pre`, use: [`source-map-loader`] }] }, - output: { filename: '[name].js', library: mainExport, libraryTarget: `umd`, umdNamedDefine: true }, -}); - -module.exports = minifyTask; -module.exports.minifyTask = minifyTask; diff --git a/gulp/test-task.js b/gulp/test-task.js index f997964d..60b0b552 100644 --- a/gulp/test-task.js +++ b/gulp/test-task.js @@ -19,10 +19,18 @@ const path = require('path'); const { argv } = require('./argv'); const child_process = require(`child_process`); const { memoizeTask } = require('./memoize-task'); +const { targetAndModuleCombinations } = require('./util'); const asyncDone = require('util').promisify(require('async-done')); -const jestArgv = []; -argv.verbose && jestArgv.push(`--verbose`); +const jestArgv = [`--reporters=jest-silent-reporter`]; + +if (argv.verbose) { + jestArgv.push(`--verbose`); +} + +if (targetAndModuleCombinations.length > 1) { + jestArgv.push(`--detectOpenHandles`, `--no-cache`); +} const jest = path.join(path.parse(require.resolve(`jest`)).dir, `../bin/jest.js`); const testOptions = { @@ -31,9 +39,7 @@ const testOptions = { ...process.env, // hide fs.promises/stream[Symbol.asyncIterator] warnings NODE_NO_WARNINGS: `1`, - // prevent the user-land `readable-stream` module from - // patching node's streams -- they're better now - READABLE_STREAM: `disable` + TS_JEST_DISABLE_VER_CHECKER: true }, }; @@ -41,17 +47,14 @@ const testTask = ((cache, execArgv, testOptions) => memoizeTask(cache, function const args = [...execArgv]; const opts = { ...testOptions }; if (argv.coverage) { - args.push(`-c`, `jest.coverage.config.js`, `--coverage`, `--no-cache`); + args.push(`-c`, `jest.coverage.config.js`, `--coverage`); } else { const cfgname = [target, format].filter(Boolean).join('.'); - args.push(`-c`, `jestconfigs/jest.${cfgname}.config.js`, `-i`, `--no-cache`, `spec/*`); + args.push(`-c`, `jestconfigs/jest.${cfgname}.config.js`, `spec/*`); } opts.env = { ...opts.env, - TEST_TARGET: target, - TEST_MODULE: format, TEST_DOM_STREAMS: (target ==='src' || format === 'umd').toString(), TEST_NODE_STREAMS: (target ==='src' || format !== 'umd').toString(), - TEST_TS_SOURCE: !!argv.coverage || (target === 'src') || (opts.env.TEST_TS_SOURCE === 'true') }; return asyncDone(() => child_process.spawn(`node`, args, opts)); }))({}, [jest, ...jestArgv], testOptions); diff --git a/gulp/util.js b/gulp/util.js index 489b1b7f..a0a28bdb 100644 --- a/gulp/util.js +++ b/gulp/util.js @@ -138,13 +138,19 @@ function shouldRunInChildProcess(target, format) { const gulp = path.join(path.parse(require.resolve(`gulp`)).dir, `bin/gulp.js`); function spawnGulpCommandInChildProcess(command, target, format) { - const args = [gulp, command, '-t', target, '-m', format, `--silent`]; - const opts = { - stdio: [`ignore`, `inherit`, `inherit`], - env: { ...process.env, NODE_NO_WARNINGS: `1` } - }; - return asyncDone(() => child_process.spawn(`node`, args, opts)) - .catch((e) => { throw `Error in "${command}:${taskName(target, format)}" task`; }); + const err = []; + return asyncDone(() => { + const child = child_process.spawn( + `node`, + [gulp, command, '-t', target, '-m', format, `-L`], + { + stdio: [`ignore`, `ignore`, `pipe`], + env: { ...process.env, NODE_NO_WARNINGS: `1` } + }); + child.stderr.on('data', (line) => err.push(line)); + return child; + }).catch(() => Promise.reject(err.length > 0 ? err.join('\n') + : `Error in "${command}:${taskName(target, format)}" task.`)); } const logAndDie = (e) => { if (e) { process.exit(1) } }; @@ -230,5 +236,7 @@ module.exports = { gCCLanguageNames, UMDSourceTargets, terserLanguageNames, taskName, packageName, tsconfigName, targetDir, combinations, observableFromStreams, - ESKeywords, esmRequire, shouldRunInChildProcess, spawnGulpCommandInChildProcess, getUMDExportName + ESKeywords, esmRequire, shouldRunInChildProcess, spawnGulpCommandInChildProcess, getUMDExportName, + + targetAndModuleCombinations: [...combinations(targets, modules)] }; diff --git a/jest.config.js b/jest.config.js index e7c4ff1f..01de06ad 100644 --- a/jest.config.js +++ b/jest.config.js @@ -17,9 +17,6 @@ module.exports = { "verbose": false, - "reporters": [ - ["jest-silent-reporter", { "useDots": true, "showWarnings": true }] - ], "testEnvironment": "node", "globals": { "ts-jest": { @@ -27,7 +24,7 @@ module.exports = { "tsConfig": "spec/tsconfig.json" } }, - "rootDir": "../", + "rootDir": "./", "roots": [ "/spec/" ], diff --git a/jestconfigs/jest.es2015.cjs.config.js b/jestconfigs/jest.es2015.cjs.config.js index 4577abcd..df623ff3 100644 --- a/jestconfigs/jest.es2015.cjs.config.js +++ b/jestconfigs/jest.es2015.cjs.config.js @@ -1,12 +1,13 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.es2015.cjs.json" + "tsConfig": "/spec/tsconfig/tsconfig.es2015.cjs.json" } }, "moduleNameMapper": { "^ix(.*)": "/targets/es2015/cjs$1" - } + } }; diff --git a/jestconfigs/jest.es2015.esm.config.js b/jestconfigs/jest.es2015.esm.config.js index 47969e96..ac41583f 100644 --- a/jestconfigs/jest.es2015.esm.config.js +++ b/jestconfigs/jest.es2015.esm.config.js @@ -1,12 +1,13 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.es2015.esm.json" + "tsConfig": "/spec/tsconfig/tsconfig.es2015.esm.json" } }, "moduleNameMapper": { "^ix(.*)": "/targets/es2015/esm$1" - } + } }; diff --git a/jestconfigs/jest.es2015.umd.config.js b/jestconfigs/jest.es2015.umd.config.js index b4ab8f0a..0ec33828 100644 --- a/jestconfigs/jest.es2015.umd.config.js +++ b/jestconfigs/jest.es2015.umd.config.js @@ -1,9 +1,10 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.es2015.umd.json" + "tsConfig": "/spec/tsconfig/tsconfig.es2015.umd.json" } }, "moduleNameMapper": { diff --git a/jestconfigs/jest.es5.cjs.config.js b/jestconfigs/jest.es5.cjs.config.js index 93d6f48f..81d610dc 100644 --- a/jestconfigs/jest.es5.cjs.config.js +++ b/jestconfigs/jest.es5.cjs.config.js @@ -1,12 +1,13 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.es5.cjs.json" + "tsConfig": "/spec/tsconfig/tsconfig.es5.cjs.json" } }, "moduleNameMapper": { "^ix(.*)": "/targets/es5/cjs$1" - } + } }; diff --git a/jestconfigs/jest.es5.esm.config.js b/jestconfigs/jest.es5.esm.config.js index a240e033..a1a774bf 100644 --- a/jestconfigs/jest.es5.esm.config.js +++ b/jestconfigs/jest.es5.esm.config.js @@ -1,12 +1,13 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.es5.esm.json" + "tsConfig": "/spec/tsconfig/tsconfig.es5.esm.json" } }, "moduleNameMapper": { "^ix(.*)": "/targets/es5/esm$1" - } + } }; diff --git a/jestconfigs/jest.es5.umd.config.js b/jestconfigs/jest.es5.umd.config.js index fa203b08..cb2dfd06 100644 --- a/jestconfigs/jest.es5.umd.config.js +++ b/jestconfigs/jest.es5.umd.config.js @@ -1,9 +1,10 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.es5.umd.json" + "tsConfig": "/spec/tsconfig/tsconfig.es5.umd.json" } }, "moduleNameMapper": { @@ -12,5 +13,5 @@ module.exports = { "^ix/iterable/operators(.*)": "/targets/es5/umd/Ix.dom.iterable.operators.js", "^ix/iterable(.*)": "/targets/es5/umd/Ix.dom.iterable.js", "^ix(.*)": "/targets/es5/umd/Ix.dom.js" - } + } }; diff --git a/jestconfigs/jest.esnext.cjs.config.js b/jestconfigs/jest.esnext.cjs.config.js index 38b50a9a..c65466e5 100644 --- a/jestconfigs/jest.esnext.cjs.config.js +++ b/jestconfigs/jest.esnext.cjs.config.js @@ -1,12 +1,13 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.esnext.cjs.json" + "tsConfig": "/spec/tsconfig/tsconfig.esnext.cjs.json" } }, "moduleNameMapper": { "^ix(.*)": "/targets/esnext/cjs$1" - } + } }; diff --git a/jestconfigs/jest.esnext.esm.config.js b/jestconfigs/jest.esnext.esm.config.js index 71450250..936c3fc8 100644 --- a/jestconfigs/jest.esnext.esm.config.js +++ b/jestconfigs/jest.esnext.esm.config.js @@ -1,12 +1,13 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.esnext.esm.json" + "tsConfig": "/spec/tsconfig/tsconfig.esnext.esm.json" } }, "moduleNameMapper": { "^ix(.*)": "/targets/esnext/esm$1" - } + } }; diff --git a/jestconfigs/jest.esnext.umd.config.js b/jestconfigs/jest.esnext.umd.config.js index 801afe73..2622d976 100644 --- a/jestconfigs/jest.esnext.umd.config.js +++ b/jestconfigs/jest.esnext.umd.config.js @@ -1,9 +1,10 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.esnext.umd.json" + "tsConfig": "/spec/tsconfig/tsconfig.esnext.umd.json" } }, "moduleNameMapper": { diff --git a/jestconfigs/jest.ix.config.js b/jestconfigs/jest.ix.config.js index 44b39daa..9e7c5d4c 100644 --- a/jestconfigs/jest.ix.config.js +++ b/jestconfigs/jest.ix.config.js @@ -1,12 +1,13 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.ix.json" + "tsConfig": "/spec/tsconfig/tsconfig.ix.json" } }, "moduleNameMapper": { "^ix(.*)": "/targets/ix$1" - } + } }; diff --git a/jestconfigs/jest.src.config.js b/jestconfigs/jest.src.config.js index e2f6a543..fae1ce1f 100644 --- a/jestconfigs/jest.src.config.js +++ b/jestconfigs/jest.src.config.js @@ -1,5 +1,6 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, diff --git a/jestconfigs/jest.ts.config.js b/jestconfigs/jest.ts.config.js index 32f0a0b8..7da07800 100644 --- a/jestconfigs/jest.ts.config.js +++ b/jestconfigs/jest.ts.config.js @@ -1,12 +1,13 @@ module.exports = { ...require('../jest.config'), + "rootDir": "../", "globals": { "ts-jest": { "diagnostics": false, - "tsConfig": "spec/tsconfig/tsconfig.ts.json" + "tsConfig": "/spec/tsconfig/tsconfig.ts.json" } }, "moduleNameMapper": { "^ix(.*)": "/targets/ts$1" - } + } }; diff --git a/package.json b/package.json index 3320640d..1492151d 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,8 @@ "devDependencies": { "@types/glob": "7.1.1", "@types/jest": "25.1.3", - "@typescript-eslint/eslint-plugin": "2.21.0", - "@typescript-eslint/parser": "2.21.0", + "@typescript-eslint/eslint-plugin": "4.26.0", + "@typescript-eslint/parser": "4.26.0", "abortcontroller-polyfill": "1.4.0", "async-done": "1.3.2", "benchmark": "2.1.4", @@ -66,10 +66,11 @@ "coveralls": "3.0.9", "cz-conventional-changelog": "3.1.0", "del": "5.1.0", - "eslint": "6.8.0", + "eslint": "7.27.0", + "eslint-plugin-jest": "24.3.6", "esm": "3.2.25", "glob": "7.1.6", - "google-closure-compiler": "20200517.0.0", + "google-closure-compiler": "20210601.0.0", "gulp": "4.0.2", "gulp-json-transform": "0.4.7", "gulp-rename": "2.0.0", @@ -97,7 +98,7 @@ "ts-jest": "25.2.1", "ts-node": "8.6.2", "typedoc": "0.16.10", - "typescript": "3.9.3", + "typescript": "4.3.5", "validate-commit-msg": "2.14.0", "web-stream-tools": "0.0.1", "web-streams-polyfill": "2.1.0", diff --git a/spec/asynciterable-operators/catcherror-spec.ts b/spec/asynciterable-operators/catcherror-spec.ts index c6f6a728..d5113edb 100644 --- a/spec/asynciterable-operators/catcherror-spec.ts +++ b/spec/asynciterable-operators/catcherror-spec.ts @@ -18,11 +18,11 @@ test('AsyncIterable#catchError error catches', async () => { test('AsyncIterable#catchError no error misses', async () => { const xs = range(0, 10); const res = xs.pipe(catchError(async (_: Error) => of(42))); - expect(sequenceEqual(res, xs)).resolves.toBeTruthy(); + await expect(sequenceEqual(res, xs)).resolves.toBeTruthy(); }); test('AsyncIterable#catchError source and handler types are composed', async () => { const xs = range(0, 10); const res = xs.pipe(catchError(async (_: Error) => of('foo'))); - expect(sequenceEqual(res, xs)).resolves.toBeTruthy(); + await expect(sequenceEqual(res, xs)).resolves.toBeTruthy(); }); diff --git a/spec/asynciterable-operators/debounce-spec.ts b/spec/asynciterable-operators/debounce-spec.ts index 66ac43a7..e367c5e5 100644 --- a/spec/asynciterable-operators/debounce-spec.ts +++ b/spec/asynciterable-operators/debounce-spec.ts @@ -51,13 +51,9 @@ test( const ys = as(xs()).pipe(debounce(300)); const controller = new AbortController(); const it = ys[Symbol.asyncIterator](controller.signal); - try { - await hasNext(it, 1); - controller.abort(); - await hasNext(it, 3); - } catch (e) { - expect(e).toBeInstanceOf(AbortError); - } + await hasNext(it, 1); + controller.abort(); + await expect(hasNext(it, 3)).rejects.toThrow(AbortError); await noNext(it); }, 10 * 1000 diff --git a/spec/asynciterable-operators/defaultifempty-spec.ts b/spec/asynciterable-operators/defaultifempty-spec.ts index 2dccb9ab..08293fb5 100644 --- a/spec/asynciterable-operators/defaultifempty-spec.ts +++ b/spec/asynciterable-operators/defaultifempty-spec.ts @@ -25,9 +25,5 @@ test('AsyncIterable#defaultIfEmpty throws', async () => { const ys = xs.pipe(defaultIfEmpty(0)); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(); }); diff --git a/spec/asynciterable-operators/filter-spec.ts b/spec/asynciterable-operators/filter-spec.ts index 3df8db51..b3f1b6be 100644 --- a/spec/asynciterable-operators/filter-spec.ts +++ b/spec/asynciterable-operators/filter-spec.ts @@ -67,11 +67,7 @@ test('AsyncIterable#filter throws part way through', async () => { await hasNext(it, 8); await hasNext(it, 5); await hasNext(it, 7); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#filter with index throws part way through', async () => { @@ -90,11 +86,7 @@ test('AsyncIterable#filter with index throws part way through', async () => { await hasNext(it, 8); await hasNext(it, 5); await hasNext(it, 7); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#filter with error source', async () => { @@ -102,11 +94,7 @@ test('AsyncIterable#filter with error source', async () => { const ys = xs.pipe(filter(async (x) => x % 2 === 0)); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(); }); test('AsyncIterable#filter with empty source', async () => { diff --git a/spec/asynciterable-operators/finalize-spec.ts b/spec/asynciterable-operators/finalize-spec.ts index b124621f..6d6dba3e 100644 --- a/spec/asynciterable-operators/finalize-spec.ts +++ b/spec/asynciterable-operators/finalize-spec.ts @@ -39,11 +39,7 @@ test('AsyncIterable#finally calls even with error', async () => { const it = xs[Symbol.asyncIterator](); expect(done).toBeFalsy(); - try { - await hasNext(it, 0); - } catch (e) { - expect(e).toEqual(err); - } + await expect(hasNext(it, 0)).rejects.toThrow(err); expect(done).toBeTruthy(); }); diff --git a/spec/asynciterable-operators/flatmap-spec.ts b/spec/asynciterable-operators/flatmap-spec.ts index 60417f2f..7f0dec44 100644 --- a/spec/asynciterable-operators/flatmap-spec.ts +++ b/spec/asynciterable-operators/flatmap-spec.ts @@ -25,11 +25,7 @@ test('Iterable#flatMap selector returns throw', async () => { hasNext(it, 0); hasNext(it, 0); hasNext(it, 1); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(err); }); test('Iterable#flatMap with error throws', async () => { @@ -38,11 +34,7 @@ test('Iterable#flatMap with error throws', async () => { const ys = xs.pipe(flatMap((x) => range(0, x))); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(err); }); test('Iterable#flatMap selector throws error', async () => { @@ -61,9 +53,5 @@ test('Iterable#flatMap selector throws error', async () => { hasNext(it, 0); hasNext(it, 0); hasNext(it, 1); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/asynciterable-operators/groupjoin-spec.ts b/spec/asynciterable-operators/groupjoin-spec.ts index 72445f76..9be04c78 100644 --- a/spec/asynciterable-operators/groupjoin-spec.ts +++ b/spec/asynciterable-operators/groupjoin-spec.ts @@ -54,11 +54,7 @@ test('AsyncIterable#groupJoin left throws', async () => { ); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#groupJoin right throws', async () => { @@ -75,11 +71,7 @@ test('AsyncIterable#groupJoin right throws', async () => { ); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#groupJoin left selector throws', async () => { @@ -98,11 +90,7 @@ test('AsyncIterable#groupJoin left selector throws', async () => { ); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#groupJoin right selector throws', async () => { @@ -121,11 +109,7 @@ test('AsyncIterable#groupJoin right selector throws', async () => { ); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#groupJoin result selector eventually throws', async () => { @@ -148,9 +132,5 @@ test('AsyncIterable#groupJoin result selector eventually throws', async () => { const it = res[Symbol.asyncIterator](); await hasNext(it, '0 - 36'); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/asynciterable-operators/innerjoin-spec.ts b/spec/asynciterable-operators/innerjoin-spec.ts index a0071aa9..68ad08df 100644 --- a/spec/asynciterable-operators/innerjoin-spec.ts +++ b/spec/asynciterable-operators/innerjoin-spec.ts @@ -89,11 +89,7 @@ test('AsyncIterable#innerJoin left throws', async () => { ); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(); }); test('AsyncIterable#innerJoin right throws', async () => { @@ -109,11 +105,7 @@ test('AsyncIterable#innerJoin right throws', async () => { ); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(); }); test('AsyncIterable#innerJoin left selector throws', async () => { @@ -131,11 +123,7 @@ test('AsyncIterable#innerJoin left selector throws', async () => { ); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(); }); test('AsyncIterable#innerJoin right selector throws', async () => { @@ -153,11 +141,7 @@ test('AsyncIterable#innerJoin right selector throws', async () => { ); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(); }); test('AsyncIterable#innerJoin result selector throws', async () => { @@ -175,9 +159,5 @@ test('AsyncIterable#innerJoin result selector throws', async () => { ); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(); }); diff --git a/spec/asynciterable-operators/memoize-spec.ts b/spec/asynciterable-operators/memoize-spec.ts index 9e6588e2..b8d815a9 100644 --- a/spec/asynciterable-operators/memoize-spec.ts +++ b/spec/asynciterable-operators/memoize-spec.ts @@ -139,11 +139,7 @@ test('AsyncIterable#memoize max two readers', async () => { await hasNext(it2, 2); const it3 = rng[Symbol.asyncIterator](); - try { - await it3.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it3.next()).rejects.toThrow(); }); test('AsyncIterable#memoize concat with error', async () => { @@ -154,29 +150,9 @@ test('AsyncIterable#memoize concat with error', async () => { const it2 = rng[Symbol.asyncIterator](); await hasNext(it1, 0); await hasNext(it1, 1); - try { - await it1.next(); - } catch (e) { - expect(error).toEqual(e); - } + await expect(it1.next()).rejects.toThrow(error); await hasNext(it2, 0); await hasNext(it2, 1); - try { - await it2.next(); - } catch (e) { - expect(error).toEqual(e); - } + await expect(it2.next()).rejects.toThrow(error); }); - -function getRandom() { - const min = 0; - const max = Math.pow(2, 53) - 1; - return Math.floor(Math.random() * (max - min)) + min; -} - -async function* rand() { - while (1) { - yield getRandom(); - } -} diff --git a/spec/asynciterable-operators/orderby-spec.ts b/spec/asynciterable-operators/orderby-spec.ts index a11dad7e..ed6686c5 100644 --- a/spec/asynciterable-operators/orderby-spec.ts +++ b/spec/asynciterable-operators/orderby-spec.ts @@ -25,11 +25,7 @@ test('AsyncIterable#orderBy normal ordering with thenBy throws', async () => { ); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#orderBy selector throws', async () => { @@ -42,11 +38,7 @@ test('AsyncIterable#orderBy selector throws', async () => { ); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#orderByDescending normal ordering', async () => { @@ -72,9 +64,5 @@ test('AsyncIterable#orderByDescending normal ordering with thenByDescending thro ); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/asynciterable-operators/publish-spec.ts b/spec/asynciterable-operators/publish-spec.ts index 83e6e249..da22eb05 100644 --- a/spec/asynciterable-operators/publish-spec.ts +++ b/spec/asynciterable-operators/publish-spec.ts @@ -125,17 +125,9 @@ test('AsyncIterbale#publish shared exceptions', async () => { await hasNext(it1, 0); await hasNext(it1, 1); - try { - await it1.next(); - } catch (e) { - expect(error).toEqual(e); - } + await expect(it1.next()).rejects.toThrow(error); await hasNext(it2, 0); await hasNext(it2, 1); - try { - await it2.next(); - } catch (e) { - expect(error).toEqual(e); - } + await expect(it2.next()).rejects.toThrow(error); }); diff --git a/spec/asynciterable-operators/retry-spec.ts b/spec/asynciterable-operators/retry-spec.ts index 5972c806..c171b955 100644 --- a/spec/asynciterable-operators/retry-spec.ts +++ b/spec/asynciterable-operators/retry-spec.ts @@ -26,9 +26,5 @@ test('AsyncIterable#retry finite eventually gives up', async () => { await hasNext(it, 1); await hasNext(it, 0); await hasNext(it, 1); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/asynciterable-operators/reverse-spec.ts b/spec/asynciterable-operators/reverse-spec.ts index cd0678b1..a919e6e8 100644 --- a/spec/asynciterable-operators/reverse-spec.ts +++ b/spec/asynciterable-operators/reverse-spec.ts @@ -35,9 +35,5 @@ test('AsyncIterable#reverse throws', async () => { const ys = xs.pipe(reverse()); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(); }); diff --git a/spec/asynciterable-operators/skip-spec.ts b/spec/asynciterable-operators/skip-spec.ts index 1cab8955..e20e384d 100644 --- a/spec/asynciterable-operators/skip-spec.ts +++ b/spec/asynciterable-operators/skip-spec.ts @@ -38,9 +38,5 @@ test('AsyncIterable#skip throws', async () => { const ys = xs.pipe(skip(2)); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/asynciterable-operators/skipwhile-spec.ts b/spec/asynciterable-operators/skipwhile-spec.ts index 86a0b90d..47b647e6 100644 --- a/spec/asynciterable-operators/skipwhile-spec.ts +++ b/spec/asynciterable-operators/skipwhile-spec.ts @@ -55,11 +55,7 @@ test('AsyncIterable#skipWhile predicate throws', async () => { ); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#skipWhile with index', async () => { diff --git a/spec/asynciterable-operators/take-spec.ts b/spec/asynciterable-operators/take-spec.ts index ac24b16f..73fc8d8e 100644 --- a/spec/asynciterable-operators/take-spec.ts +++ b/spec/asynciterable-operators/take-spec.ts @@ -39,9 +39,5 @@ test('AsyncIterable#take throws with error', async () => { const ys = xs.pipe(take(2)); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/asynciterable-operators/takewhile-spec.ts b/spec/asynciterable-operators/takewhile-spec.ts index 92df4d73..b5a2629a 100644 --- a/spec/asynciterable-operators/takewhile-spec.ts +++ b/spec/asynciterable-operators/takewhile-spec.ts @@ -52,9 +52,5 @@ test('AsyncIterable#takeWhile predicate throws', async () => { ); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/asynciterable-operators/tap-spec.ts b/spec/asynciterable-operators/tap-spec.ts index cd654294..c13a3f53 100644 --- a/spec/asynciterable-operators/tap-spec.ts +++ b/spec/asynciterable-operators/tap-spec.ts @@ -43,22 +43,21 @@ test('AsyncIterable#tap with error', async () => { const err = new Error(); let ok = false; - try { - const source = throwError(err).pipe( - tap({ - error: async (e) => { - expect(e).toEqual(err); - ok = true; - }, - }) - ); - - // eslint-disable-next-line no-empty - for await (const _ of source) { - } - } catch (e) { - expect(e).toEqual(err); - } + const source = throwError(err).pipe( + tap({ + error: async (e) => { + expect(e).toEqual(err); + ok = true; + }, + }) + ); + + // eslint-disable-next-line no-empty + await expect( + (async () => { + for await (const _ of source); + })() + ).rejects.toThrow(err); expect(ok).toBeTruthy(); }); @@ -75,8 +74,8 @@ test('AsyncItearble#tap with next function', async () => { }); class MyObserver { - public sum: number = 0; - public done: boolean = false; + public sum = 0; + public done = false; async next(value: number) { this.sum += value; diff --git a/spec/asynciterable-operators/timeout-spec.ts b/spec/asynciterable-operators/timeout-spec.ts index cabf30ff..3d724d40 100644 --- a/spec/asynciterable-operators/timeout-spec.ts +++ b/spec/asynciterable-operators/timeout-spec.ts @@ -27,10 +27,6 @@ test('AsyncIterable#timeout throws when delayed', async () => { const it = ys[Symbol.asyncIterator](); await hasNext(it, 1); - try { - await it.next(); - } catch (e) { - expect(e).toBeInstanceOf(TimeoutError); - } + await expect(it.next()).rejects.toThrow(TimeoutError); await noNext(it); }); diff --git a/spec/asynciterable/aborting-spec.ts b/spec/asynciterable/aborting-spec.ts index e5ff4e0b..8a303b53 100644 --- a/spec/asynciterable/aborting-spec.ts +++ b/spec/asynciterable/aborting-spec.ts @@ -2,12 +2,14 @@ import '../asynciterablehelpers'; import { interval } from 'ix/asynciterable'; import { take } from 'ix/asynciterable/operators'; -test('Abort signal isn\'t overloaded with event listeners', async () => { +test("Abort signal isn't overloaded with event listeners", async () => { const abortController = new AbortController(); const listeners: (() => void)[] = []; + // eslint-disable-next-line jest/no-jasmine-globals spyOn(abortController.signal, 'addEventListener').and.callFake((_, listener) => listeners.push(listener) ); + // eslint-disable-next-line jest/no-jasmine-globals spyOn(abortController.signal, 'removeEventListener').and.callFake((_, listener) => listeners.splice(listeners.indexOf(listener), 1) ); diff --git a/spec/asynciterable/asyncify-spec.ts b/spec/asynciterable/asyncify-spec.ts index 34aed52e..92fe56cc 100644 --- a/spec/asynciterable/asyncify-spec.ts +++ b/spec/asynciterable/asyncify-spec.ts @@ -3,7 +3,7 @@ import { asyncify } from 'ix/asynciterable'; import { sequenceEqual } from 'ix/iterable'; test('AsyncIterable#asyncify single argument', async () => { - const callbackFn = (a: number, b: number, cb: Function) => { + const callbackFn = (a: number, b: number, cb: (...xs: any[]) => any) => { cb(a + b); }; @@ -16,7 +16,7 @@ test('AsyncIterable#asyncify single argument', async () => { }); test('AsyncIterable#asyncify multiple arguments', async () => { - const callbackFn = (a: number, b: number, cb: Function) => { + const callbackFn = (a: number, b: number, cb: (...xs: any[]) => any) => { cb(a, b); }; diff --git a/spec/asynciterable/asyncifyerrback-spec.ts b/spec/asynciterable/asyncifyerrback-spec.ts index 7745d296..ae321181 100644 --- a/spec/asynciterable/asyncifyerrback-spec.ts +++ b/spec/asynciterable/asyncifyerrback-spec.ts @@ -3,7 +3,7 @@ import { asyncifyErrback } from 'ix/asynciterable'; import { sequenceEqual } from 'ix/iterable'; test('AsyncIterable#asyncifyErrback single argument', async () => { - const callbackFn = (a: number, b: number, cb: Function) => { + const callbackFn = (a: number, b: number, cb: (err: Error | null, ...rest: any[]) => void) => { cb(null, a + b); }; @@ -17,7 +17,7 @@ test('AsyncIterable#asyncifyErrback single argument', async () => { test('AsyncIterable#asyncifyErrback with error', async () => { const error = new Error(); - const callbackFn = (a: number, b: number, cb: Function) => { + const callbackFn = (a: number, b: number, cb: (err: Error | null, ...rest: any[]) => void) => { cb(error, a + b); }; @@ -25,15 +25,11 @@ test('AsyncIterable#asyncifyErrback with error', async () => { const xs = asyncFn(1, 2); const it = xs[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(error).toEqual(e); - } + await expect(it.next()).rejects.toThrow(error); }); test('AsyncIterable#asyncifyErrback multiple arguments', async () => { - const callbackFn = (a: number, b: number, cb: Function) => { + const callbackFn = (a: number, b: number, cb: (err: Error | null, ...rest: any[]) => void) => { cb(null, a, b); }; diff --git a/spec/asynciterable/asyncsink-spec.ts b/spec/asynciterable/asyncsink-spec.ts index e0d015f2..d6d8eaa3 100644 --- a/spec/asynciterable/asyncsink-spec.ts +++ b/spec/asynciterable/asyncsink-spec.ts @@ -30,11 +30,7 @@ test('AsyncSink writes and errors before next', async () => { await hasNext(it, 1); await hasNext(it, 2); await hasNext(it, 3); - try { - await it.next(); - } catch (e) { - expect(err).toBe(e); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncSink writes after next', async () => { @@ -46,7 +42,7 @@ test('AsyncSink writes after next', async () => { a.write(3); const results = await asyncResults; - const mappedResults = results.map(x => x.value); + const mappedResults = results.map((x) => x.value); expect(mappedResults).toEqual([1, 2, 3]); }); @@ -59,9 +55,5 @@ test('AsyncSink writes and error after next', async () => { a.write(2); a.error(err); - try { - await asyncResults; - } catch (e) { - expect(err).toBe(e); - } + await expect(asyncResults).rejects.toThrow(err); }); diff --git a/spec/asynciterable/average-spec.ts b/spec/asynciterable/average-spec.ts index 7e43a394..12688616 100644 --- a/spec/asynciterable/average-spec.ts +++ b/spec/asynciterable/average-spec.ts @@ -3,11 +3,7 @@ import { average, empty, of } from 'ix/asynciterable'; test('Iterable#average empty', async () => { const xs = empty(); - try { - await average(xs); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(average(xs)).rejects.toThrow(); }); test('Iterable#average', async () => { @@ -17,11 +13,7 @@ test('Iterable#average', async () => { test('Iterable#average with selector empty', async () => { const xs = empty(); - try { - await average(xs, { selector: async (x) => x * 2 }); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(average(xs, { selector: async (x) => x * 2 })).rejects.toThrow(); }); test('Iterable#average with selector', async () => { diff --git a/spec/asynciterable/catcherror-spec.ts b/spec/asynciterable/catcherror-spec.ts index 0c38de34..f0f352a0 100644 --- a/spec/asynciterable/catcherror-spec.ts +++ b/spec/asynciterable/catcherror-spec.ts @@ -29,9 +29,5 @@ test('AsyncIterable#catch still throws', async () => { await hasNext(it, 1); await hasNext(it, 2); await hasNext(it, 3); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(it.next()).rejects.toThrow(); }); diff --git a/spec/asynciterable/count-spec.ts b/spec/asynciterable/count-spec.ts index 7473a788..9f7253b6 100644 --- a/spec/asynciterable/count-spec.ts +++ b/spec/asynciterable/count-spec.ts @@ -21,11 +21,7 @@ test('AsyncIterable#count throws', async () => { const err = new Error(); const xs = throwError(err); - try { - await count(xs); - } catch (e) { - expect(e).toEqual(err); - } + await expect(count(xs)).rejects.toThrow(err); }); test('AsyncIterable#count predicate some match', async () => { @@ -56,13 +52,11 @@ test('AsyncIterable#count predicate throws', async () => { const err = new Error(); const xs = of(1, 2, 3, 4); - try { - await count(xs, { + await expect( + count(xs, { predicate: async () => { throw err; }, - }); - } catch (e) { - expect(e).toEqual(err); - } + }) + ).rejects.toThrow(err); }); diff --git a/spec/asynciterable/elementat-spec.ts b/spec/asynciterable/elementat-spec.ts index 20d3942a..08c6482b 100644 --- a/spec/asynciterable/elementat-spec.ts +++ b/spec/asynciterable/elementat-spec.ts @@ -4,7 +4,7 @@ import { elementAt, empty, of } from 'ix/asynciterable'; test('AsyncIterable#elementAt empty returns undefined', async () => { const xs = empty(); const res = await elementAt(xs, 0); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('AsyncIterable#elementAt single value first index', async () => { @@ -16,7 +16,7 @@ test('AsyncIterable#elementAt single value first index', async () => { test('AsyncIterable#elementAt single value invalid index', async () => { const xs = of(42); const res = await elementAt(xs, 1); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('AsyncIterable#elementAt multiple values valid index', async () => { @@ -28,5 +28,5 @@ test('AsyncIterable#elementAt multiple values valid index', async () => { test('AsyncIterable#elementAt multiple values invalid index', async () => { const xs = of(1, 42, 3); const res = await elementAt(xs, 7); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); diff --git a/spec/asynciterable/every-spec.ts b/spec/asynciterable/every-spec.ts index db4db343..f63a0d25 100644 --- a/spec/asynciterable/every-spec.ts +++ b/spec/asynciterable/every-spec.ts @@ -21,24 +21,18 @@ test('AsyncIterable#every throws', async () => { const err = new Error(); const xs = throwError(err); - try { - await every(xs, { predicate: async (x) => x % 2 === 0 }); - } catch (e) { - expect(e).toEqual(err); - } + await expect(every(xs, { predicate: async (x) => x % 2 === 0 })).rejects.toThrow(err); }); test('AsyncIterable#every predicate throws', async () => { const err = new Error(); const xs = of(1, 2, 3, 4); - try { - await every(xs, { + await expect( + every(xs, { predicate: async () => { throw err; }, - }); - } catch (e) { - expect(e).toEqual(err); - } + }) + ).rejects.toThrow(err); }); diff --git a/spec/asynciterable/first-spec.ts b/spec/asynciterable/first-spec.ts index ba47eef1..5afff9ff 100644 --- a/spec/asynciterable/first-spec.ts +++ b/spec/asynciterable/first-spec.ts @@ -4,7 +4,7 @@ import { empty, first, of } from 'ix/asynciterable'; test('AsyncIterable#first empty returns undefined', async () => { const xs = empty(); const ys = await first(xs); - expect(ys).toBe(undefined); + expect(ys).toBeUndefined(); }); test('AsyncIterable#first no predicate returns first', async () => { @@ -16,7 +16,7 @@ test('AsyncIterable#first no predicate returns first', async () => { test('AsyncIterable#first predicate empty returns undefined', async () => { const xs = empty(); const ys = await first(xs, { predicate: async () => true }); - expect(ys).toBe(undefined); + expect(ys).toBeUndefined(); }); test('AsyncIterable#first predicate hits returns value', async () => { @@ -28,5 +28,5 @@ test('AsyncIterable#first predicate hits returns value', async () => { test('AsyncIterable#first predicate misses returns undefined', async () => { const xs = of(1, 3, 5); const ys = await first(xs, { predicate: async (x) => x % 2 === 0 }); - expect(ys).toBe(undefined); + expect(ys).toBeUndefined(); }); diff --git a/spec/asynciterable/forkjoin-spec.ts b/spec/asynciterable/forkjoin-spec.ts index 029226f1..d5e9555a 100644 --- a/spec/asynciterable/forkjoin-spec.ts +++ b/spec/asynciterable/forkjoin-spec.ts @@ -44,7 +44,7 @@ test('AsyncIterable#forkJoin no selector first empty', async () => { const zs = of(39, 42, 25); const res = await forkJoin(xs, ys, zs); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('AsyncIterable#forkJoin no selector middle empty', async () => { @@ -53,7 +53,7 @@ test('AsyncIterable#forkJoin no selector middle empty', async () => { const zs = of(39, 42, 25); const res = await forkJoin(xs, ys, zs); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('AsyncIterable#forkJoin no selector last empty', async () => { @@ -62,5 +62,5 @@ test('AsyncIterable#forkJoin no selector last empty', async () => { const zs = empty(); const res = await forkJoin(xs, ys, zs); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); diff --git a/spec/asynciterable/from-spec.ts b/spec/asynciterable/from-spec.ts index a63597d1..ee32fb64 100644 --- a/spec/asynciterable/from-spec.ts +++ b/spec/asynciterable/from-spec.ts @@ -127,15 +127,8 @@ test('AsyncIterable#from from promise with selector', async () => { await noNext(it); }); -test('AsyncIterable#from from with non-iterable throws', (done) => { - let error = false; - try { - from({} as any); - } catch (e) { - error = true; - } - // eslint-disable-next-line no-unused-expressions - error ? done() : done.fail('expected from to throw'); +test('AsyncIterable#from from with non-iterable throws', () => { + expect(() => from({} as any)).toThrow(); }); interface Observer { @@ -187,7 +180,7 @@ test('AsyncIterable#fromObservable with completion', async () => { await noNext(it); }); -test('AsyncIterable#fromObservable with completion', async () => { +test('AsyncIterable#fromObservable with map selector and completion', async () => { const xs = new TestObservable((obs) => { obs.next(42); obs.complete(); @@ -251,9 +244,5 @@ test('AsyncIterable#fromObservable with error', async () => { const ys = from(xs); const it = ys[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/asynciterable/fromdomstream-spec.ts b/spec/asynciterable/fromdomstream-spec.ts index 03ec9869..dd2e1dc2 100644 --- a/spec/asynciterable/fromdomstream-spec.ts +++ b/spec/asynciterable/fromdomstream-spec.ts @@ -10,7 +10,7 @@ import { from, fromDOMStream } from 'ix/asynciterable'; }); } - // eslint-disable-next-line @typescript-eslint/no-require-imports + // eslint-disable-next-line const { toStream } = require('web-stream-tools').default; class Counter extends Readable { @@ -51,7 +51,7 @@ import { from, fromDOMStream } from 'ix/asynciterable'; test('objectMode: false', async () => { const c = toStream(new Counter({ objectMode: false })); const xs = fromDOMStream(c) as AsyncIterable; - const expected = from(['1', '2', '3'].map(s => Buffer.from(s))); + const expected = from(['1', '2', '3'].map((s) => Buffer.from(s))); await expect(xs).toEqualStream(expected, compare); }); }); diff --git a/spec/asynciterable/generate-spec.ts b/spec/asynciterable/generate-spec.ts index 721942d5..c7be1144 100644 --- a/spec/asynciterable/generate-spec.ts +++ b/spec/asynciterable/generate-spec.ts @@ -31,11 +31,7 @@ test('AsyncIterable#generate condition throws', async () => { const it = xs[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#generate increment throws', async () => { @@ -50,12 +46,8 @@ test('AsyncIterable#generate increment throws', async () => { ); const it = xs[Symbol.asyncIterator](); - - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).resolves.toBeDefined(); + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#generate result selector throws', async () => { @@ -71,9 +63,5 @@ test('AsyncIterable#generate result selector throws', async () => { const it = xs[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/asynciterable/generatetime-spec.ts b/spec/asynciterable/generatetime-spec.ts index cf8a846d..fa682bf1 100644 --- a/spec/asynciterable/generatetime-spec.ts +++ b/spec/asynciterable/generatetime-spec.ts @@ -33,11 +33,7 @@ test('AsyncIterable#generateTime condition throws', async () => { const it = xs[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#generateTime increment throws', async () => { @@ -53,12 +49,8 @@ test('AsyncIterable#generateTime increment throws', async () => { ); const it = xs[Symbol.asyncIterator](); - - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).resolves.toBeDefined(); + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#generateTime result selector throws', async () => { @@ -75,11 +67,7 @@ test('AsyncIterable#generateTime result selector throws', async () => { const it = xs[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#generateTime time selector throws', async () => { @@ -96,9 +84,5 @@ test('AsyncIterable#generateTime time selector throws', async () => { const it = xs[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/asynciterable/inference-spec.ts b/spec/asynciterable/inference-spec.ts index bb922742..deddd551 100644 --- a/spec/asynciterable/inference-spec.ts +++ b/spec/asynciterable/inference-spec.ts @@ -1,20 +1,20 @@ import '../asynciterablehelpers'; import { of } from 'ix/asynciterable'; import { PassThrough } from 'stream'; -import { map, toDOMStream, toNodeStream } from 'ix/asynciterable/operators/index.node'; +import { map } from 'ix/asynciterable/operators/index.node'; -const TEST_DOM_STREAMS = toDOMStream && process.env.TEST_DOM_STREAMS === 'true'; -const TEST_NODE_STREAMS = toNodeStream && process.env.TEST_NODE_STREAMS === 'true'; +const TEST_DOM_STREAMS = process.env.TEST_DOM_STREAMS === 'true'; +const TEST_NODE_STREAMS = process.env.TEST_NODE_STREAMS === 'true'; describe('AsyncIterable type inference', () => { test('#pipe type inference is correct with one operator', () => { - const source = of(0, 1, 2).pipe(map(x => x + 1)); + const source = of(0, 1, 2).pipe(map((x) => x + 1)); expect(source).toEqualStream([1, 2, 3]); }); test('#pipe type inference is correct with two operators', () => { const source = of(0, 1, 2).pipe( - map(x => x + 1), - map(x => x + 1) + map((x) => x + 1), + map((x) => x + 1) ); expect(source).toEqualStream([2, 3, 4]); }); @@ -37,7 +37,7 @@ describe('AsyncIterable type inference', () => { }); test('#pipeThrough type inference is correct with transform stream and pipe options', () => { const source = of(0, 1, 2).pipeThrough(new TransformStream(), { - preventClose: false + preventClose: false, }); expect(source).toEqualStream([0, 1, 2]); }); diff --git a/spec/asynciterable/last-spec.ts b/spec/asynciterable/last-spec.ts index 1d03306e..39cd66f6 100644 --- a/spec/asynciterable/last-spec.ts +++ b/spec/asynciterable/last-spec.ts @@ -4,7 +4,7 @@ import { of, empty, last } from 'ix/asynciterable'; test('AsyncIterable#last empty returns undefined', async () => { const xs = empty(); const ys = await last(xs); - expect(ys).toBe(undefined); + expect(ys).toBeUndefined(); }); test('AsyncIterable#last no predicate returns first', async () => { @@ -16,7 +16,7 @@ test('AsyncIterable#last no predicate returns first', async () => { test('AsyncIterable#last predicate empty returns undefined', async () => { const xs = empty(); const ys = await last(xs, { predicate: async () => true }); - expect(ys).toBe(undefined); + expect(ys).toBeUndefined(); }); test('AsyncIterable#last predicate hits returns value', async () => { @@ -28,5 +28,5 @@ test('AsyncIterable#last predicate hits returns value', async () => { test('AsyncIterable#last predicate misses returns undefined', async () => { const xs = of(1, 3, 5); const ys = await last(xs, { predicate: async (x) => x % 2 === 0 }); - expect(ys).toBe(undefined); + expect(ys).toBeUndefined(); }); diff --git a/spec/asynciterable/max-spec.ts b/spec/asynciterable/max-spec.ts index 538ffcd8..41f8013f 100644 --- a/spec/asynciterable/max-spec.ts +++ b/spec/asynciterable/max-spec.ts @@ -8,11 +8,7 @@ test('AsyncItearble#max laws', async () => { test('AsyncIterable#max empty throws', async () => { const xs = empty(); - try { - await max(xs); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(max(xs)).rejects.toThrow(); }); test('AsyncIterable#max', async () => { diff --git a/spec/asynciterable/maxby-spec.ts b/spec/asynciterable/maxby-spec.ts index eed44774..896c710a 100644 --- a/spec/asynciterable/maxby-spec.ts +++ b/spec/asynciterable/maxby-spec.ts @@ -12,9 +12,5 @@ test('AsyncIterable#maxBy', async () => { test('AsyncIterable#maxBy empty throws', async () => { const source = empty(); - try { - await maxBy(source, { selector: async (x) => Math.floor(x / 2) }); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(maxBy(source, { selector: async (x) => Math.floor(x / 2) })).rejects.toThrow(); }); diff --git a/spec/asynciterable/min-spec.ts b/spec/asynciterable/min-spec.ts index 47c81d57..6a4153f1 100644 --- a/spec/asynciterable/min-spec.ts +++ b/spec/asynciterable/min-spec.ts @@ -8,11 +8,7 @@ test('AsyncItearble#min laws', async () => { test('AsyncIterable#min empty throws', async () => { const xs = empty(); - try { - await min(xs); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(min(xs)).rejects.toThrow(); }); test('AsyncIterable#min', async () => { diff --git a/spec/asynciterable/minby-spec.ts b/spec/asynciterable/minby-spec.ts index cf9d8098..6d90d0e8 100644 --- a/spec/asynciterable/minby-spec.ts +++ b/spec/asynciterable/minby-spec.ts @@ -12,9 +12,5 @@ test('AsyncIterable#minBy', async () => { test('AsyncIterable#minBy empty throws', async () => { const source = empty(); - try { - await minBy(source, { selector: (x) => Math.floor(x / 2) }); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(minBy(source, { selector: (x) => Math.floor(x / 2) })).rejects.toThrow(); }); diff --git a/spec/asynciterable/reduce-spec.ts b/spec/asynciterable/reduce-spec.ts index f2c49b4b..0e88854f 100644 --- a/spec/asynciterable/reduce-spec.ts +++ b/spec/asynciterable/reduce-spec.ts @@ -9,11 +9,9 @@ test('Iterable#reduce no seed', async () => { test('Iterable#reduce no seed empty throws', async () => { const xs = empty(); - try { - await reduce(xs, { callback: (x, y, i) => x + y + i }); - } catch (e) { - expect(e !== null).toBeTruthy(); - } + await expect( + reduce(xs, { callback: (x, y, i) => x + y + i }) + ).rejects.toThrow(); }); test('Iterable#reduce with seed', async () => { diff --git a/spec/asynciterable/reduceright-spec.ts b/spec/asynciterable/reduceright-spec.ts index 772de68c..d55794bf 100644 --- a/spec/asynciterable/reduceright-spec.ts +++ b/spec/asynciterable/reduceright-spec.ts @@ -9,11 +9,9 @@ test('AsyncIterable#reduceRight no seed', async () => { test('AsyncIterable#reduceRight no seed empty throws', async () => { const xs = empty(); - try { - await reduceRight(xs, { callback: (x, y, i) => x + y + i }); - } catch (e) { - expect(e !== null).toBeTruthy(); - } + await expect( + reduceRight(xs, { callback: (x, y, i) => x + y + i }) + ).rejects.toThrow(); }); test('AsyncIterable#reduceRight with seed', async () => { diff --git a/spec/asynciterable/sequenceequal-spec.ts b/spec/asynciterable/sequenceequal-spec.ts index 0f296be1..86cd7a65 100644 --- a/spec/asynciterable/sequenceequal-spec.ts +++ b/spec/asynciterable/sequenceequal-spec.ts @@ -40,11 +40,7 @@ test('AsyncIterable#sequenceEqual left throws', async () => { const xs = throwError(err); const ys = of(1, 2, 3); - try { - await sequenceEqual(xs, ys); - } catch (e) { - expect(e).toEqual(err); - } + await expect(sequenceEqual(xs, ys)).rejects.toThrow(err); }); test('AsyncIterable#sequenceEqual right throws', async () => { @@ -52,11 +48,7 @@ test('AsyncIterable#sequenceEqual right throws', async () => { const xs = of(1, 2, 3); const ys = throwError(err); - try { - await sequenceEqual(xs, ys); - } catch (e) { - expect(e).toEqual(err); - } + await expect(sequenceEqual(xs, ys)).rejects.toThrow(err); }); test('AsyncIterable#sequenceEqual with ccustom omparer sequence equals itself', async () => { @@ -104,11 +96,7 @@ test('AsyncIterable#sequenceEqual with custom comparer left throws', async () => const xs = throwError(err); const ys = of(1, 2, 3); - try { - await sequenceEqual(xs, ys, { comparer: comparer }); - } catch (e) { - expect(e).toEqual(err); - } + await expect(sequenceEqual(xs, ys, { comparer: comparer })).rejects.toThrow(err); }); test('AsyncIterable#sequenceEqual with custom comparer right throws', async () => { @@ -117,11 +105,7 @@ test('AsyncIterable#sequenceEqual with custom comparer right throws', async () = const xs = of(1, 2, 3); const ys = throwError(err); - try { - await sequenceEqual(xs, ys, { comparer: comparer }); - } catch (e) { - expect(e).toEqual(err); - } + await expect(sequenceEqual(xs, ys, { comparer: comparer })).rejects.toThrow(err); }); test('Itearble#sequenceEqual with custom comparer should be equal', async () => { @@ -140,9 +124,5 @@ test('Itearble#sequenceEqual with custom comparer throws', async () => { const xs = of(1, 2, -3, 4); const ys = of(1, -2, 3, 4); - try { - await sequenceEqual(xs, ys, { comparer: comparer }); - } catch (e) { - expect(e).toEqual(err); - } + await expect(sequenceEqual(xs, ys, { comparer: comparer })).rejects.toThrow(err); }); diff --git a/spec/asynciterable/single-spec.ts b/spec/asynciterable/single-spec.ts index 37380a2e..7cbef3e8 100644 --- a/spec/asynciterable/single-spec.ts +++ b/spec/asynciterable/single-spec.ts @@ -4,19 +4,19 @@ import { empty, of, single } from 'ix/asynciterable'; test('AsyncIterable#single no predicate empty returns undefined', async () => { const xs = empty(); const res = await single(xs); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('AsyncIterable#single with predicate empty returns undefined', async () => { const xs = empty(); const res = await single(xs, { predicate: async () => true }); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('AsyncIterable#single predicate miss', async () => { const xs = of(42); const res = await single(xs, { predicate: async (x) => x % 2 !== 0 }); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('AsyncIterable#single no predicate hit', async () => { @@ -33,18 +33,10 @@ test('AsyncIterable#single predicate hit', async () => { test('AsyncIterable#single no predicate multiple throws error', async () => { const xs = of(42, 45, 90); - try { - await single(xs); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(single(xs)).rejects.toThrow(); }); test('AsyncIterable#single with predicate multiple throws error', async () => { const xs = of(42, 45, 90); - try { - await single(xs, { predicate: async (x) => x % 2 === 0 }); - } catch (e) { - expect(e != null).toBeTruthy(); - } + await expect(single(xs, { predicate: async (x) => x % 2 === 0 })).rejects.toThrow(); }); diff --git a/spec/asynciterable/some-spec.ts b/spec/asynciterable/some-spec.ts index e6a1decb..bb8339f8 100644 --- a/spec/asynciterable/some-spec.ts +++ b/spec/asynciterable/some-spec.ts @@ -17,24 +17,18 @@ test('AsyncIterable#some throws', async () => { const err = new Error(); const xs = throwError(err); - try { - await some(xs, { predicate: async (x) => x % 2 === 0 }); - } catch (e) { - expect(e).toEqual(err); - } + await expect(some(xs, { predicate: async (x) => x % 2 === 0 })).rejects.toThrow(err); }); test('AsyncIterable#some predicate throws', async () => { const err = new Error(); const xs = of(1, 2, 3, 4); - try { - await some(xs, { + await expect( + some(xs, { predicate: async () => { throw err; }, - }); - } catch (e) { - expect(e).toEqual(err); - } + }) + ).rejects.toThrow(err); }); diff --git a/spec/asynciterable/throw-spec.ts b/spec/asynciterable/throw-spec.ts index 1a4451f4..0723190f 100644 --- a/spec/asynciterable/throw-spec.ts +++ b/spec/asynciterable/throw-spec.ts @@ -5,9 +5,6 @@ test('AsyncIterable#throw throws', async () => { const xs = throwError(new Error()); const it = xs[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + + await expect(it.next()).rejects.toThrow(); }); diff --git a/spec/asynciterable/toarray-spec.ts b/spec/asynciterable/toarray-spec.ts index e568d978..d517280c 100644 --- a/spec/asynciterable/toarray-spec.ts +++ b/spec/asynciterable/toarray-spec.ts @@ -12,5 +12,5 @@ test('AsyncIterable#toArray some', async () => { test('AsyncIterable#toArray empty', async () => { const xs = empty(); const res = await toArray(xs); - expect(res.length).toBe(0); + expect(res).toHaveLength(0); }); diff --git a/spec/asynciterable/tonodestream-spec.ts b/spec/asynciterable/tonodestream-spec.ts index 9204a9da..0be76dd5 100644 --- a/spec/asynciterable/tonodestream-spec.ts +++ b/spec/asynciterable/tonodestream-spec.ts @@ -1,5 +1,6 @@ import '../asynciterablehelpers'; -import { from, AsyncIterableReadable } from 'ix/asynciterable'; +import { from } from 'ix/asynciterable'; +import { AsyncIterableReadable } from 'ix/Ix.node'; import { map, toNodeStream } from 'ix/asynciterable/operators/index.node'; // eslint-disable-next-line consistent-return @@ -10,9 +11,9 @@ import { map, toNodeStream } from 'ix/asynciterable/operators/index.node'; }); } - const stringsItr = () => from([1, 2, 3]).pipe(map(i => `${i}`)); - const buffersItr = () => stringsItr().pipe(map(val => Buffer.from(val))); - const objectsItr = () => stringsItr().pipe(map(val => ({ val }))); + const stringsItr = () => from([1, 2, 3]).pipe(map((i) => `${i}`)); + const buffersItr = () => stringsItr().pipe(map((val) => Buffer.from(val))); + const objectsItr = () => stringsItr().pipe(map((val) => ({ val }))); const compare = (a: T, b: T) => { const aVal = ArrayBuffer.isView(a) ? `${Buffer.from(a.buffer, a.byteOffset, a.byteLength)}` : a; const bVal = ArrayBuffer.isView(b) ? `${Buffer.from(b.buffer, b.byteOffset, b.byteLength)}` : b; @@ -28,8 +29,8 @@ import { map, toNodeStream } from 'ix/asynciterable/operators/index.node'; describe('AsyncIterable#toNodeStream', () => { describe('objectMode: true', () => { const expectedStrings = ['1', '2', '3']; - const expectedObjects = expectedStrings.map(val => ({ val })); - const expectedBuffers = expectedStrings.map(x => Buffer.from(x)); + const expectedObjects = expectedStrings.map((val) => ({ val })); + const expectedBuffers = expectedStrings.map((x) => Buffer.from(x)); test('yields Strings', async () => { await expect(stringsItr().pipe(toNodeStream({ objectMode: true }))).toEqualStream( from(expectedStrings), @@ -52,7 +53,7 @@ import { map, toNodeStream } from 'ix/asynciterable/operators/index.node'; describe('objectMode: false', () => { const expectedStrings = ['123']; - const expectedBuffers = expectedStrings.map(x => Buffer.from(x)); + const expectedBuffers = expectedStrings.map((x) => Buffer.from(x)); test('yields Strings', async () => { await expect(stringsItr().pipe(toNodeStream({ objectMode: false }))).toEqualStream( from(expectedStrings), diff --git a/spec/asynciterable/zip-spec.ts b/spec/asynciterable/zip-spec.ts index 0dad56e8..93788b3e 100644 --- a/spec/asynciterable/zip-spec.ts +++ b/spec/asynciterable/zip-spec.ts @@ -102,11 +102,8 @@ test('AsyncIterable#zip left throws', async () => { const res = zip(xs, ys); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + + await expect(it.next()).rejects.toThrow(err); }); test('AsyncIterable#zip right throws', async () => { @@ -116,9 +113,6 @@ test('AsyncIterable#zip right throws', async () => { const res = zip(xs, ys); const it = res[Symbol.asyncIterator](); - try { - await it.next(); - } catch (e) { - expect(e).toEqual(err); - } + + await expect(it.next()).rejects.toThrow(err); }); diff --git a/spec/index.ts b/spec/index.ts index 38fa35da..87d92f5c 100644 --- a/spec/index.ts +++ b/spec/index.ts @@ -5,11 +5,12 @@ process.on('unhandledRejection', (error: any) => { }); const cwd = process.cwd(); +// eslint-disable-next-line const resolve = require('path').resolve; // eslint-disable-next-line @typescript-eslint/no-var-requires require('glob')('./spec/**/*-spec.ts', (err: Error, files: string[]) => { if (err) { throw err; } - files.forEach(file => require(resolve(cwd, file))); + files.forEach((file) => require(resolve(cwd, file))); }); diff --git a/spec/iterable-operators/filter-spec.ts b/spec/iterable-operators/filter-spec.ts index 62fa3bd0..a1e1c369 100644 --- a/spec/iterable-operators/filter-spec.ts +++ b/spec/iterable-operators/filter-spec.ts @@ -29,27 +29,17 @@ test('Iterable#filter with index', () => { }); test('Iterable#filter with typeguard', () => { - const xs = [ - new String('8'), - 5, - new String('7'), - 4, - new String('6'), - 9, - new String('2'), - 1, - new String('0'), - ]; - const ys: Iterable = filter( - (x): x is String => x instanceof String + const xs = ['8', 5, '7', 4, '6', 9, '2', 1, '0']; + const ys: Iterable = filter( + (x): x is string => typeof x === 'string' )(xs); const it = ys[Symbol.iterator](); - hasNext(it, new String('8')); - hasNext(it, new String('7')); - hasNext(it, new String('6')); - hasNext(it, new String('2')); - hasNext(it, new String('0')); + hasNext(it, '8'); + hasNext(it, '7'); + hasNext(it, '6'); + hasNext(it, '2'); + hasNext(it, '0'); noNext(it); }); diff --git a/spec/iterable-operators/finally-spec.ts b/spec/iterable-operators/finally-spec.ts index d7713d11..ede387ba 100644 --- a/spec/iterable-operators/finally-spec.ts +++ b/spec/iterable-operators/finally-spec.ts @@ -31,11 +31,7 @@ test('Iterable#finally calls even with error', () => { const it = xs[Symbol.iterator](); expect(done).toBeFalsy(); - try { - hasNext(it, 0); - } catch (e) { - expect(e).toEqual(err); - } + expect(() => hasNext(it, 0)).toThrow(err); expect(done).toBeTruthy(); }); diff --git a/spec/iterable-operators/map-spec.ts b/spec/iterable-operators/map-spec.ts index 56848641..5f413eed 100644 --- a/spec/iterable-operators/map-spec.ts +++ b/spec/iterable-operators/map-spec.ts @@ -82,5 +82,5 @@ test('Iterable#map source returns expected values', () => { index++; } - expect(source.length).toBe(index); + expect(source).toHaveLength(index); }); diff --git a/spec/iterable-operators/tap-spec.ts b/spec/iterable-operators/tap-spec.ts index c2e6d068..3a7aec08 100644 --- a/spec/iterable-operators/tap-spec.ts +++ b/spec/iterable-operators/tap-spec.ts @@ -62,8 +62,8 @@ test('Iterable#tap with error', () => { }); class MyObserver { - public sum: number = 0; - public done: boolean = false; + public sum = 0; + public done = false; next(value: number) { this.sum += value; diff --git a/spec/iterable/catcherror-spec.ts b/spec/iterable/catcherror-spec.ts index 6859f48f..bb086026 100644 --- a/spec/iterable/catcherror-spec.ts +++ b/spec/iterable/catcherror-spec.ts @@ -29,9 +29,5 @@ test('Iterable.catchError still throws', () => { hasNext(it, 1); hasNext(it, 2); hasNext(it, 3); - try { - it.next(); - } catch (e) { - expect(e != null).toBeTruthy(); - } + expect(() => it.next()).toThrow(); }); diff --git a/spec/iterable/elementat-spec.ts b/spec/iterable/elementat-spec.ts index 34d2c837..c63df2c2 100644 --- a/spec/iterable/elementat-spec.ts +++ b/spec/iterable/elementat-spec.ts @@ -3,7 +3,7 @@ import { elementAt } from 'ix/iterable'; test('Iterable#elementAt empty returns undefined', () => { const res = elementAt([], 0); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('Iterable#elementAt single value first index', () => { @@ -13,7 +13,7 @@ test('Iterable#elementAt single value first index', () => { test('Iterable#elementAt single value invalid index', () => { const res = elementAt([42], 1); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('Iterable#elementAt multiple values valid index', () => { @@ -23,5 +23,5 @@ test('Iterable#elementAt multiple values valid index', () => { test('Iterable#elementAt multiple values invalid index', () => { const res = elementAt([1, 42, 3], 7); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); diff --git a/spec/iterable/first-spec.ts b/spec/iterable/first-spec.ts index 40843390..b0ea3eb1 100644 --- a/spec/iterable/first-spec.ts +++ b/spec/iterable/first-spec.ts @@ -2,7 +2,7 @@ import '../iterablehelpers'; import { first } from 'ix/iterable'; test('Iterable#first empty returns undefined', () => { - expect(first([])).toBe(undefined); + expect(first([])).toBeUndefined(); }); test('Iterable#first no predicate returns first', () => { @@ -12,7 +12,7 @@ test('Iterable#first no predicate returns first', () => { test('Iterable#first predicate empty returns undefined', () => { expect( first([], { predicate: () => true }) - ).toBe(undefined); + ).toBeUndefined(); }); test('Iterable#first predicate hits returns value', () => { @@ -20,5 +20,5 @@ test('Iterable#first predicate hits returns value', () => { }); test('Iterable#first predicate misses returns undefined', () => { - expect(first([1, 3, 5], { predicate: (x) => x % 2 === 0 })).toBe(undefined); + expect(first([1, 3, 5], { predicate: (x) => x % 2 === 0 })).toBeUndefined(); }); diff --git a/spec/iterable/from-spec.ts b/spec/iterable/from-spec.ts index ba058d8b..e20c2877 100644 --- a/spec/iterable/from-spec.ts +++ b/spec/iterable/from-spec.ts @@ -81,13 +81,6 @@ test('Iterable#from from array-like with selector', () => { noNext(it); }); -test('Iterable#from from with non-iterable throws', done => { - let error = false; - try { - from({} as any); - } catch (e) { - error = true; - } - // eslint-disable-next-line no-unused-expressions - error ? done() : done.fail('expected from to throw'); +test('Iterable#from from with non-iterable throws', () => { + expect(() => from({} as any)).toThrow(); }); diff --git a/spec/iterable/inference-spec.ts b/spec/iterable/inference-spec.ts index 05397695..948a224c 100644 --- a/spec/iterable/inference-spec.ts +++ b/spec/iterable/inference-spec.ts @@ -2,20 +2,20 @@ import '../iterablehelpers'; import '../asynciterablehelpers'; import { PassThrough } from 'stream'; import { of } from 'ix/iterable'; -import { map, toDOMStream, toNodeStream } from 'ix/iterable/operators/index.node'; +import { map } from 'ix/iterable/operators/index.node'; -const TEST_DOM_STREAMS = toDOMStream && process.env.TEST_DOM_STREAMS === 'true'; -const TEST_NODE_STREAMS = toNodeStream && process.env.TEST_NODE_STREAMS === 'true'; +const TEST_DOM_STREAMS = process.env.TEST_DOM_STREAMS === 'true'; +const TEST_NODE_STREAMS = process.env.TEST_NODE_STREAMS === 'true'; describe('Iterable type inference', () => { test('#pipe type inference is correct with one operator', () => { - const source = of(0, 1, 2).pipe(map(x => x + 1)); + const source = of(0, 1, 2).pipe(map((x) => x + 1)); expect(source).toEqualStream([1, 2, 3]); }); test('#pipe type inference is correct with two operators', () => { const source = of(0, 1, 2).pipe( - map(x => x + 1), - map(x => x + 1) + map((x) => x + 1), + map((x) => x + 1) ); expect(source).toEqualStream([2, 3, 4]); }); @@ -38,7 +38,7 @@ describe('Iterable type inference', () => { }); test('#pipeThrough type inference is correct with writable stream and pipe options', () => { const source = of(0, 1, 2).pipeThrough(new TransformStream(), { - preventClose: false + preventClose: false, }); expect(source).toEqualStream([0, 1, 2]); }); diff --git a/spec/iterable/last-spec.ts b/spec/iterable/last-spec.ts index 7d6c2198..dba1db07 100644 --- a/spec/iterable/last-spec.ts +++ b/spec/iterable/last-spec.ts @@ -2,7 +2,7 @@ import '../iterablehelpers'; import { last } from 'ix/iterable'; test('Iterable#last empty returns undefined', () => { - expect(last([])).toBe(undefined); + expect(last([])).toBeUndefined(); }); test('Iterable#last no predicate returns first', () => { @@ -12,7 +12,7 @@ test('Iterable#last no predicate returns first', () => { test('Iterable#last predicate empty returns undefined', () => { expect( last([], { predicate: () => true }) - ).toBe(undefined); + ).toBeUndefined(); }); test('Iterable#last predicate hits returns value', () => { @@ -20,5 +20,5 @@ test('Iterable#last predicate hits returns value', () => { }); test('Iterable#last predicate misses returns undefined', () => { - expect(last([1, 3, 5], { predicate: (x) => x % 2 === 0 })).toBe(undefined); + expect(last([1, 3, 5], { predicate: (x) => x % 2 === 0 })).toBeUndefined(); }); diff --git a/spec/iterable/maxby-spec.ts b/spec/iterable/maxby-spec.ts index ab7ab47a..1228942a 100644 --- a/spec/iterable/maxby-spec.ts +++ b/spec/iterable/maxby-spec.ts @@ -11,9 +11,5 @@ test('Iterable#maxBy', () => { test('Iterable#maxBy empty throws', () => { const source = empty(); - try { - maxBy(source, { selector: (x) => Math.floor(x / 2) }); - } catch (e) { - expect(e != null).toBeTruthy(); - } + expect(() => maxBy(source, { selector: (x) => Math.floor(x / 2) })).toThrow(); }); diff --git a/spec/iterable/minby-spec.ts b/spec/iterable/minby-spec.ts index d3c289a4..bfb4895a 100644 --- a/spec/iterable/minby-spec.ts +++ b/spec/iterable/minby-spec.ts @@ -11,9 +11,5 @@ test('Iterable#minBy', () => { test('Iterable#minBy empty throws', () => { const source = empty(); - try { - minBy(source, { selector: (x) => Math.floor(x / 2) }); - } catch (e) { - expect(e != null).toBeTruthy(); - } + expect(() => minBy(source, { selector: (x) => Math.floor(x / 2) })).toThrow(); }); diff --git a/spec/iterable/repeatvalue-spec.ts b/spec/iterable/repeatvalue-spec.ts index 5357fca9..ddd73522 100644 --- a/spec/iterable/repeatvalue-spec.ts +++ b/spec/iterable/repeatvalue-spec.ts @@ -34,7 +34,7 @@ test('Iterable#repeatValue toArray produce correct result', () => { }); test('Iterable#repeatValue works with null element', () => { - const objectInstance: null = null; + const objectInstance = null; const array = toArray(repeatValue(objectInstance, 100)); expect(100).toBe(array.length); @@ -45,7 +45,7 @@ test('Iterable#repeatValue works with null element', () => { test('Iterable#repeatValue zero count leads to empty sequence', () => { const array = toArray(repeatValue(1, 0)); - expect(array.length).toBe(0); + expect(array).toHaveLength(0); }); test('Iterable#repeatValue not enumerate after end', () => { @@ -126,15 +126,15 @@ test('Iterable#repeatValue count', () => { expect(42).toBe(count(repeatValue('test', 42))); }); -test('Iterable#repeatValue infinite', () => { - const xs = repeatValue(42).pipe(take(100)); +test('Iterable#repeatValue count 100', () => { + const xs = repeatValue(42, 100); expect(every(xs, { predicate: (x) => x === 42 })).toBeTruthy(); expect(count(xs)).toBe(100); }); -test('Iterable#repeatValue count', () => { - const xs = repeatValue(42, 100); +test('Iterable#repeatValue count take 100', () => { + const xs = repeatValue(42).pipe(take(100)); expect(every(xs, { predicate: (x) => x === 42 })).toBeTruthy(); expect(count(xs)).toBe(100); diff --git a/spec/iterable/single-spec.ts b/spec/iterable/single-spec.ts index 7296c736..af5150de 100644 --- a/spec/iterable/single-spec.ts +++ b/spec/iterable/single-spec.ts @@ -3,17 +3,17 @@ import { single } from 'ix/iterable'; test('Iterable#single no predicate empty returns undefined', () => { const res = single([]); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('Iterable#single with predicate empty returns undefined', () => { const res = single([], { predicate: () => true }); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('Iterable#single predicate miss', () => { const res = single([42], { predicate: (x) => x % 2 !== 0 }); - expect(res).toBe(undefined); + expect(res).toBeUndefined(); }); test('Iterable#single no predicate hit', () => { diff --git a/spec/iterable/toarray-spec.ts b/spec/iterable/toarray-spec.ts index c353074f..cef0280f 100644 --- a/spec/iterable/toarray-spec.ts +++ b/spec/iterable/toarray-spec.ts @@ -9,5 +9,5 @@ test('Iterable#toArray some', () => { test('Iterable#toArray empty', () => { const res = toArray([]); - expect(res.length).toBe(0); + expect(res).toHaveLength(0); }); diff --git a/spec/tsconfig.json b/spec/tsconfig.json index e31868f7..860a6e17 100644 --- a/spec/tsconfig.json +++ b/spec/tsconfig.json @@ -9,6 +9,7 @@ "module": "CommonJS", "allowJs": true, "declaration": false, + "declarationMap": false, "importHelpers": false, "noEmitHelpers": false, "noEmitOnError": false, diff --git a/spec/tsconfig/tsconfig.base.json b/spec/tsconfig/tsconfig.base.json index 65a752f5..2ca75c5b 100644 --- a/spec/tsconfig/tsconfig.base.json +++ b/spec/tsconfig/tsconfig.base.json @@ -1,10 +1,12 @@ { - "extends": "../../tsconfig.json", +// "extends": "../../tsconfig.json", + "extends": "../../tsconfig/tsconfig.base.json", "compilerOptions": { "target": "esnext", "module": "commonjs", "allowJs": true, "declaration": false, + "declarationMap": false, "importHelpers": false, "noEmitHelpers": false, "noEmitOnError": false, @@ -12,6 +14,10 @@ "inlineSources": false, "inlineSourceMap": false, "downlevelIteration": false, - "baseUrl": "../../" + "baseUrl": "../../", + "paths": { + "ix": ["src/Ix.node"], + "ix/*": ["src/*"] + } } } diff --git a/src/aborterror.ts b/src/aborterror.ts index 0c047244..04e5b5e8 100644 --- a/src/aborterror.ts +++ b/src/aborterror.ts @@ -1,7 +1,7 @@ import { isObject } from './util/isiterable'; export class AbortError extends Error { - constructor(message: string = 'The operation has been aborted') { + constructor(message = 'The operation has been aborted') { super(message); Object.setPrototypeOf(this, AbortError.prototype); Error.captureStackTrace(this, this.constructor); diff --git a/src/add/asynciterable-operators/memoize.ts b/src/add/asynciterable-operators/memoize.ts index f2f90c01..af4e35d8 100644 --- a/src/add/asynciterable-operators/memoize.ts +++ b/src/add/asynciterable-operators/memoize.ts @@ -12,7 +12,7 @@ export function memoizeProto( */ export function memoizeProto( this: AsyncIterableX, - readerCount: number = -1, + readerCount = -1, selector?: (value: AsyncIterable, signal?: AbortSignal) => AsyncIterable ): AsyncIterableX { return memoize(readerCount, selector)(this); diff --git a/src/add/asynciterable-operators/repeat.ts b/src/add/asynciterable-operators/repeat.ts index 399d013e..120ce979 100644 --- a/src/add/asynciterable-operators/repeat.ts +++ b/src/add/asynciterable-operators/repeat.ts @@ -4,7 +4,7 @@ import { RepeatAsyncIterable } from '../../asynciterable/operators/repeat'; /** * @ignore */ -export function repeatProto(this: AsyncIterableX, count: number = -1): AsyncIterableX { +export function repeatProto(this: AsyncIterableX, count = -1): AsyncIterableX { return new RepeatAsyncIterable(this, count); } diff --git a/src/add/asynciterable-operators/retry.ts b/src/add/asynciterable-operators/retry.ts index b7087778..7d49e055 100644 --- a/src/add/asynciterable-operators/retry.ts +++ b/src/add/asynciterable-operators/retry.ts @@ -4,7 +4,7 @@ import { retry } from '../../asynciterable/operators/retry'; /** * @ignore */ -export function retryProto(this: AsyncIterableX, count: number = -1): AsyncIterableX { +export function retryProto(this: AsyncIterableX, count = -1): AsyncIterableX { return retry(count)(this); } diff --git a/src/add/iterable-operators/memoize.ts b/src/add/iterable-operators/memoize.ts index dc818197..b14cb617 100644 --- a/src/add/iterable-operators/memoize.ts +++ b/src/add/iterable-operators/memoize.ts @@ -15,7 +15,7 @@ export function memoizeProto( */ export function memoizeProto( this: IterableX, - readerCount: number = -1, + readerCount = -1, selector?: (value: Iterable) => Iterable ): IterableX { return memoize(readerCount, selector)(this); diff --git a/src/add/iterable-operators/reduce.ts b/src/add/iterable-operators/reduce.ts index b905fe2f..2a617b79 100644 --- a/src/add/iterable-operators/reduce.ts +++ b/src/add/iterable-operators/reduce.ts @@ -21,8 +21,10 @@ export function reduceProto( // eslint-disable-next-line no-nested-ternary typeof optionsOrAccumulator === 'function' ? arguments.length > 1 - ? { 'callback': optionsOrAccumulator, 'seed': seed } - : { 'callback': optionsOrAccumulator } + ? // prettier-ignore + { 'callback': optionsOrAccumulator, 'seed': seed } + : // prettier-ignore + { 'callback': optionsOrAccumulator } : optionsOrAccumulator ); } diff --git a/src/add/iterable-operators/reduceright.ts b/src/add/iterable-operators/reduceright.ts index 1aa4a441..a1dae994 100644 --- a/src/add/iterable-operators/reduceright.ts +++ b/src/add/iterable-operators/reduceright.ts @@ -21,8 +21,10 @@ export function reduceRightProto( // eslint-disable-next-line no-nested-ternary typeof optionsOrAccumulator === 'function' ? arguments.length > 1 - ? { 'callback': optionsOrAccumulator, 'seed': seed } - : { 'callback': optionsOrAccumulator } + ? // prettier-ignore + { 'callback': optionsOrAccumulator, 'seed': seed } + : // prettier-ignore + { 'callback': optionsOrAccumulator } : optionsOrAccumulator ); } diff --git a/src/add/iterable-operators/repeat.ts b/src/add/iterable-operators/repeat.ts index 00e33c63..1f28a298 100644 --- a/src/add/iterable-operators/repeat.ts +++ b/src/add/iterable-operators/repeat.ts @@ -4,7 +4,7 @@ import { repeat } from '../../iterable/operators/repeat'; /** * @ignore */ -export function repeatProto(this: IterableX, count: number = -1): IterableX { +export function repeatProto(this: IterableX, count = -1): IterableX { return repeat(count)(this); } diff --git a/src/add/iterable-operators/retry.ts b/src/add/iterable-operators/retry.ts index aad17a57..f12f59c0 100644 --- a/src/add/iterable-operators/retry.ts +++ b/src/add/iterable-operators/retry.ts @@ -4,7 +4,7 @@ import { retry } from '../../iterable/operators/retry'; /** * @ignore */ -export function retryProto(this: IterableX, count: number = -1): IterableX { +export function retryProto(this: IterableX, count = -1): IterableX { return retry(count)(this); } diff --git a/src/add/iterable-operators/scan.ts b/src/add/iterable-operators/scan.ts index 7f6f5fc0..e0fba02a 100644 --- a/src/add/iterable-operators/scan.ts +++ b/src/add/iterable-operators/scan.ts @@ -21,8 +21,10 @@ export function scanProto( // eslint-disable-next-line no-nested-ternary typeof optionsOrAccumulator === 'function' ? arguments.length > 1 - ? { 'callback': optionsOrAccumulator, 'seed': seed } - : { 'callback': optionsOrAccumulator } + ? // prettier-ignore + { 'callback': optionsOrAccumulator, 'seed': seed } + : // prettier-ignore + { 'callback': optionsOrAccumulator } : optionsOrAccumulator ); } diff --git a/src/add/iterable-operators/scanright.ts b/src/add/iterable-operators/scanright.ts index 0ce1a02f..84ba6b85 100644 --- a/src/add/iterable-operators/scanright.ts +++ b/src/add/iterable-operators/scanright.ts @@ -24,8 +24,10 @@ export function scanRightProto( // eslint-disable-next-line no-nested-ternary typeof optionsOrAccumulator === 'function' ? arguments.length > 1 - ? { 'callback': optionsOrAccumulator, 'seed': seed } - : { 'callback': optionsOrAccumulator } + ? // prettier-ignore + { 'callback': optionsOrAccumulator, 'seed': seed } + : // prettier-ignore + { 'callback': optionsOrAccumulator } : optionsOrAccumulator ); } diff --git a/src/asynciterable/as.ts b/src/asynciterable/as.ts index b7366a06..8f0e1f4d 100644 --- a/src/asynciterable/as.ts +++ b/src/asynciterable/as.ts @@ -17,7 +17,6 @@ import { /** * Converts an existing string into an async-iterable of characters. * - * @export * @param {string} source The string to convert to an async-iterable. * @returns {AsyncIterableX} An async-iterable stream of characters from the source. */ @@ -25,7 +24,6 @@ export function as(source: string): AsyncIterableX; /** * Converts the async iterable like input into an async-iterable. * - * @export * @template T The type of elements in the async-iterable like sequence. * @param {AsyncIterableInput} source The async-iterable like input to convert to an async-iterable. * @returns {AsyncIterableX} An async-iterable stream from elements in the async-iterable like sequence. @@ -34,7 +32,6 @@ export function as(source: AsyncIterableInput): AsyncIterableX; /** * Converts the single element into an async-iterable sequence. * - * @export * @template T The type of the input to turn into an async-iterable sequence. * @param {T} source The single element to turn into an async-iterable sequence. * @returns {AsyncIterableX} An async-iterable sequence which contains the single element. @@ -43,7 +40,6 @@ export function as(source: T): AsyncIterableX; /** * Converts the input into an async-iterable sequence. * - * @export * @param {*} source The source to convert to an async-iterable sequence. * @returns {AsyncIterableX<*>} An async-iterable containing the input. */ diff --git a/src/asynciterable/asasynciterable.ts b/src/asynciterable/asasynciterable.ts index 7a8d2006..2897b564 100644 --- a/src/asynciterable/asasynciterable.ts +++ b/src/asynciterable/asasynciterable.ts @@ -1,26 +1,6 @@ import { AsyncIterableX } from './asynciterablex'; import { OperatorAsyncFunction, UnaryFunction } from '../interfaces'; -import { Transform, TransformCallback } from 'stream'; - -export interface TransformOptions { - // ReadableOptions/WritableOptions - highWaterMark?: number; - objectMode?: boolean; - autoDestroy?: boolean; - // ReadableOptions - encoding?: string; - // WritableOptions - decodeStrings?: boolean; - defaultEncoding?: string; - emitClose?: boolean; - // DuplexOptions - allowHalfOpen?: boolean; - readableObjectMode?: boolean; - writableObjectMode?: boolean; - readableHighWaterMark?: number; - writableHighWaterMark?: number; - writableCorked?: number; -} +import { Transform, TransformCallback, TransformOptions } from 'stream'; export interface AsyncIterableTransform extends AsyncIterableX, Transform { pipe(...operations: UnaryFunction, R>[]): R; diff --git a/src/asynciterable/asyncify.ts b/src/asynciterable/asyncify.ts index b58c27e2..f2f8da49 100644 --- a/src/asynciterable/asyncify.ts +++ b/src/asynciterable/asyncify.ts @@ -5,12 +5,13 @@ import { memoize } from './operators/memoize'; /** * Converts the callback function into wrapped function which returns an async-iterable. * - * @export * @template TSource The type of the value returned from the callback. * @param {Function} func The callback function to wrap as an async-iterable. * @returns {(...args: any[]) => AsyncIterableX} A function when invoked, returns an async-iterable from the callback. */ -export function asyncify(func: Function): (...args: any[]) => AsyncIterableX { +export function asyncify( + func: (...xs: any[]) => any +): (...args: any[]) => AsyncIterableX { return function (...args: any[]) { const sink = new AsyncSink(); diff --git a/src/asynciterable/asyncifyerrback.ts b/src/asynciterable/asyncifyerrback.ts index 50848d6b..33f2dc3d 100644 --- a/src/asynciterable/asyncifyerrback.ts +++ b/src/asynciterable/asyncifyerrback.ts @@ -5,13 +5,12 @@ import { memoize } from './operators/memoize'; /** * Converts a Node.js style error first callback to an async-iterable sequence. * - * @export * @template TSource The type of the returned value from the callback. * @param {Function} func The Node.js error first callback to convert to an async-iterable. * @returns {(...args: any[]) => AsyncIterableX} A function, when invoked, contains the result of the callback as an async-iterable. */ export function asyncifyErrback( - func: Function + func: (...xs: any[]) => any ): (...args: any[]) => AsyncIterableX { return function (...args: any[]) { const sink = new AsyncSink(); diff --git a/src/asynciterable/asynciterablex.ts b/src/asynciterable/asynciterablex.ts index 3a8bc61b..054a2e18 100644 --- a/src/asynciterable/asynciterablex.ts +++ b/src/asynciterable/asynciterablex.ts @@ -142,7 +142,7 @@ declare module '../asynciterable/asynciterablex' { op8: OperatorAsyncFunction, op9: OperatorAsyncFunction ): AsyncIterableX; - pipe(...operations: OperatorAsyncFunction[]): AsyncIterableX<{}>; + pipe(...operations: OperatorAsyncFunction[]): AsyncIterableX; pipe(op1: A, options?: { end?: boolean }): A; } } diff --git a/src/asynciterable/asyncsink.ts b/src/asynciterable/asyncsink.ts index 10b76996..ac69b7f2 100644 --- a/src/asynciterable/asyncsink.ts +++ b/src/asynciterable/asyncsink.ts @@ -8,7 +8,7 @@ interface AsyncSinkItem { } interface AsyncResolver { - resolve: (value?: T | PromiseLike | undefined) => void; + resolve: (value: T | PromiseLike) => void; reject: (reason?: any) => void; } diff --git a/src/asynciterable/average.ts b/src/asynciterable/average.ts index 769e1dac..0a9d8be8 100644 --- a/src/asynciterable/average.ts +++ b/src/asynciterable/average.ts @@ -6,7 +6,6 @@ import { MathOptions } from './mathoptions'; /** * Computes the average of the async-iterable sequence. * - * @export * @param {AsyncIterable} source The source async-iterable sequence to compute the average. * @param {AverageOptions} [options] The options for calculating the average. * @returns {Promise} A Promise which returns the computed average for the async-iterable sequence. @@ -18,7 +17,6 @@ export async function average( /** * Computes the average of the async-iterable sequence. * - * @export * @template TSource The type of elements in the source sequence. * @param {AsyncIterable} source source async-iterable sequence to compute the average. * @param {AverageOptions} [options] The options for calculating the average. @@ -31,7 +29,6 @@ export async function average( /** * Computes the average of the async-iterable sequence. * - * @export * @param {AsyncIterable} source source async-iterable sequence to compute the average. * @param {AverageOptions} [options] The options for calculating the average. * @returns {Promise} A Promise which returns the computed average for the async-iterable sequence. diff --git a/src/asynciterable/catcherror.ts b/src/asynciterable/catcherror.ts index 73c4e506..a3d60e26 100644 --- a/src/asynciterable/catcherror.ts +++ b/src/asynciterable/catcherror.ts @@ -57,7 +57,6 @@ export class CatchAllAsyncIterable extends AsyncIterableX { /** * Continues an async-iterable sequence that is terminated by an exception with the next async-iterable sequence. * - * @export * @template T The type of the elements in the source and handler sequences. * @param {Iterable>} source async-iterable sequences to catch exceptions for. * @returns {AsyncIterableX} An async-iterable sequence containing elements from consecutive source @@ -70,7 +69,6 @@ export function catchAll(source: Iterable>): AsyncIterableX< /** * Continues an async-iterable sequence that is terminated by an exception with the next async-iterable sequence. * - * @export * @template T The type of the elements in the source and handler sequences. * @param {...AsyncIterable[]} args async-iterable sequences to catch exceptions for. * @returns {AsyncIterableX} An async-iterable sequence containing elements from consecutive source diff --git a/src/asynciterable/combinelatest.ts b/src/asynciterable/combinelatest.ts index 4b5eb6c6..72566532 100644 --- a/src/asynciterable/combinelatest.ts +++ b/src/asynciterable/combinelatest.ts @@ -68,7 +68,6 @@ export class CombineLatestAsyncIterable extends AsyncIterableX} source First async-iterable source. @@ -83,7 +82,6 @@ export function combineLatest( * Merges multiple async-iterable sequences into one async-iterable sequence as an array whenever * one of the async-iterable sequences produces an element. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -101,7 +99,6 @@ export function combineLatest( * Merges multiple async-iterable sequences into one async-iterable sequence as an array whenever * one of the async-iterable sequences produces an element. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -122,7 +119,6 @@ export function combineLatest( * Merges multiple async-iterable sequences into one async-iterable sequence as an array whenever * one of the async-iterable sequences produces an element. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -146,7 +142,6 @@ export function combineLatest( * Merges multiple async-iterable sequences into one async-iterable sequence as an array whenever * one of the async-iterable sequences produces an element. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -174,7 +169,6 @@ export function combineLatest( * Merges multiple async-iterable sequences into one async-iterable sequence as an array whenever * one of the async-iterable sequences produces an element. * - * @export * @template T The of the elements in the source sequences. * @param {...AsyncIterable[]} sources The async-iterable sources. * @returns {AsyncIterableX} An async-iterable sequence containing an array of all sources. diff --git a/src/asynciterable/concat.ts b/src/asynciterable/concat.ts index a6efa639..31f01f76 100644 --- a/src/asynciterable/concat.ts +++ b/src/asynciterable/concat.ts @@ -29,7 +29,6 @@ export function _concatAll( /** * Concatenates the second async-iterable sequence to the first async-iterable sequence upon successful termination of the first. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @param {AsyncIterable} v1 First async-iterable source. @@ -42,7 +41,6 @@ export function concat(v1: AsyncIterable, v2: AsyncIterable): Asyn * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -60,7 +58,6 @@ export function concat( * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -81,7 +78,6 @@ export function concat( * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -106,7 +102,6 @@ export function concat( * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -135,7 +130,6 @@ export function concat( * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the sequences. * @param {...AsyncIterable[]} args The async-iterable sources. * @returns {AsyncIterableX} An async-iterable sequence that contains the elements of each given sequence, in sequential order. diff --git a/src/asynciterable/count.ts b/src/asynciterable/count.ts index 6e3f1a97..5838c3ca 100644 --- a/src/asynciterable/count.ts +++ b/src/asynciterable/count.ts @@ -6,7 +6,6 @@ import { OptionalFindOptions } from './findoptions'; * Returns a promise that represents how many elements in the specified async-iterable sequence satisfy a condition * otherwise, the number of items in the sequence. * - * @export * @template T The type of elements in the source collection. * @param {AsyncIterable} source An async-iterable sequence that contains elements to be counted. * @param {OptionalFindOptions} [options] The options for a predicate for filtering, thisArg for binding and AbortSignal for cancellation. diff --git a/src/asynciterable/create.ts b/src/asynciterable/create.ts index 1c51a8ae..4223eb3a 100644 --- a/src/asynciterable/create.ts +++ b/src/asynciterable/create.ts @@ -22,7 +22,6 @@ class AnonymousAsyncIterable extends AsyncIterableX { /** * Creates a new iterable using the specified function implementing the members of AsyncIterable * - * @export * @template T The type of the elements returned by the enumerable sequence. * @param {((signal?: AbortSignal) => AsyncIterator | Promise>)} fn The function that creates the [Symbol.asyncIterator]() method * @returns {AsyncIterableX} A new async-iterable instance. diff --git a/src/asynciterable/defer.ts b/src/asynciterable/defer.ts index 85e77320..e7e27919 100644 --- a/src/asynciterable/defer.ts +++ b/src/asynciterable/defer.ts @@ -24,7 +24,6 @@ class DeferAsyncIterable extends AsyncIterableX { /** * Returns an async-iterable sequence that invokes the specified factory function whenever a call to [Symbol.asyncIterator] has been made. * - * @export * @template TSource The type of the elements in the sequence returned by the factory function, and in the resulting sequence. * @param {((signal?: AbortSignal) => AsyncIterable | Promise>)} factory Async-iterable factory function to * invoke for each call to [Symbol.asyncIterator]. diff --git a/src/asynciterable/elementat.ts b/src/asynciterable/elementat.ts index ec24b114..876b1b54 100644 --- a/src/asynciterable/elementat.ts +++ b/src/asynciterable/elementat.ts @@ -4,7 +4,6 @@ import { throwIfAborted } from '../aborterror'; /** * Returns the element at a specified index in a sequence or undefined if the index is out of range. * - * @export * @template T The type of the elements in the source sequence. * @param {AsyncIterable} source async-iterable sequence to return the element from. * @param {number} index The zero-based index of the element to retrieve. diff --git a/src/asynciterable/empty.ts b/src/asynciterable/empty.ts index 4d93f5fc..f93cad0f 100644 --- a/src/asynciterable/empty.ts +++ b/src/asynciterable/empty.ts @@ -10,7 +10,6 @@ class EmptyAsyncIterable extends AsyncIterableX { /** * Returns an empty async-iterable sequence. * - * @export * @template TSource The type used for the async-iterable type parameter of the resulting sequence. * @returns {AsyncIterableX} An async-iterable sequence with no elements. */ diff --git a/src/asynciterable/every.ts b/src/asynciterable/every.ts index 4f35b89b..8d3b74b8 100644 --- a/src/asynciterable/every.ts +++ b/src/asynciterable/every.ts @@ -5,7 +5,6 @@ import { FindOptions } from './findoptions'; /** * Determines whether all elements of an async-iterable sequence satisfy a condition. * - * @export * @template T The type of the elements in the source sequence. * @param {AsyncIterable} source An async-iterable sequence whose elements to apply the predicate to. * @param {FindOptions} options The options for a predicate for filtering, thisArg for binding and AbortSignal for cancellation. diff --git a/src/asynciterable/find.ts b/src/asynciterable/find.ts index 8adfd9f0..2a2cb5c2 100644 --- a/src/asynciterable/find.ts +++ b/src/asynciterable/find.ts @@ -5,7 +5,6 @@ import { FindOptions } from './findoptions'; /** * Returns the value of the first element in the provided async-iterable that satisfies the provided testing function. * - * @export * @template T The type of the elements in the source sequence. * @param {AsyncIterable} source An async-iterable sequence whose elements to apply the predicate to. * @param {FindOptions} options The options for a predicate for filtering, thisArg for binding and AbortSignal for cancellation. diff --git a/src/asynciterable/findindex.ts b/src/asynciterable/findindex.ts index 1e886632..78d7e18b 100644 --- a/src/asynciterable/findindex.ts +++ b/src/asynciterable/findindex.ts @@ -6,7 +6,6 @@ import { FindOptions } from './findoptions'; * Returns the a Promise containing the index of the first element in the array that satisfies the provided testing function. * Otherwise, it returns a Promise with -1, indicating that no element passed the test. * - * @export * @template T The type of the elements in the source sequence. * @param {AsyncIterable} source An async-iterable sequence whose elements to apply the predicate to. * @param {FindOptions} options The options for a predicate for filtering, thisArg for binding and AbortSignal for cancellation. diff --git a/src/asynciterable/findoptions.ts b/src/asynciterable/findoptions.ts index 67c9ed89..8ec3f1d4 100644 --- a/src/asynciterable/findoptions.ts +++ b/src/asynciterable/findoptions.ts @@ -1,7 +1,6 @@ /** * A find options property bag with the selector, thisArg for binding and AbortSignal are all optional. * - * @export * @interface OptionalFindOptions * @template T The type of the elements in the source sequence. */ @@ -32,7 +31,6 @@ export interface OptionalFindOptions { /** * A find options property bag with the selector being required and the thisArg for binding and AbortSignal are all optional. * - * @export * @interface FindOptions * @template T The type of the elements in the source sequence. */ diff --git a/src/asynciterable/first.ts b/src/asynciterable/first.ts index bf93ab7d..cc605aff 100644 --- a/src/asynciterable/first.ts +++ b/src/asynciterable/first.ts @@ -5,7 +5,6 @@ import { OptionalFindOptions } from './findoptions'; /** * Returns the first element of an async-iterable sequence that matches the predicate if provided, or undefined if no such element exists. * - * @export * @template T The type of the elements in the source sequence. * @param {AsyncIterable} source Source async-enumerable sequence. * @returns {(Promise)} A Promise containing the first element in the async-iterable sequence, diff --git a/src/asynciterable/forkjoin.ts b/src/asynciterable/forkjoin.ts index 5426ef5a..480fba09 100644 --- a/src/asynciterable/forkjoin.ts +++ b/src/asynciterable/forkjoin.ts @@ -14,7 +14,6 @@ function wrapPromiseWithIndex(promise: Promise, index: number) { /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @param {AsyncIterable} source First async-iterable source. @@ -28,7 +27,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -45,7 +43,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -65,7 +62,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -88,7 +84,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -115,7 +110,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @param {AbortSignal} signal An abort signal used for cancellation at any time. * @param {AsyncIterable} source First async-iterable source. @@ -128,7 +122,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @param {AbortSignal} signal An abort signal used for cancellation at any time. @@ -144,7 +137,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -163,7 +155,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -185,7 +176,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -210,7 +200,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -239,7 +228,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the source sequences. * @param {...AsyncIterable[]} sources The source sequences. * @returns {(Promise)} An async-iterable sequence with an array of all the last elements of all sequences. @@ -249,7 +237,6 @@ export function forkJoin(...sources: AsyncIterable[]): Promise[]} sources The source sequences. @@ -263,7 +250,6 @@ export function forkJoin( /** * Runs all specified async-iterable sequences in parallel and collects their last elements. * - * @export * @template T The type of the elements in the source sequences. * @param {...any[]} sources Async-iterable sequence to collect the last elements for. * @returns {(Promise)} An async-iterable sequence with an array of all the last elements of all sequences. diff --git a/src/asynciterable/fromdomstream.ts b/src/asynciterable/fromdomstream.ts index ad2d5168..6fe26ef8 100644 --- a/src/asynciterable/fromdomstream.ts +++ b/src/asynciterable/fromdomstream.ts @@ -17,9 +17,9 @@ export class AsyncIterableReadableStream extends AsyncIterableX { [Symbol.asyncIterator]() { const stream = this._stream; - let reader: ReadableStreamBYOBReader; + let reader: ReadableStreamReader; try { - reader = stream['getReader']({ mode: 'byob' }); + reader = (stream as any)['getReader']({ mode: 'byob' }); } catch (e) { return super[Symbol.asyncIterator](); } @@ -32,7 +32,7 @@ export class AsyncIterableReadableByteStream extends AsyncIterableReadableStream async function* _consumeReader( stream: ReadableStream, - reader: ReadableStreamBYOBReader | ReadableStreamDefaultReader, + reader: ReadableStreamReader | ReadableStreamDefaultReader, iterator: AsyncGenerator ): AsyncIterator { let threw = false; @@ -43,20 +43,19 @@ async function* _consumeReader( await reader['cancel'](e); } } finally { - if (!reader) { - return; - } - if (!threw) { - await reader['cancel'](); - } - if (stream.locked) { - try { - reader.closed.catch(() => { + if (reader) { + if (!threw) { + await reader['cancel'](); + } + if (stream.locked) { + try { + reader.closed.catch(() => { + /* */ + }); + reader.releaseLock(); + } catch (e) { /* */ - }); - reader.releaseLock(); - } catch (e) { - /* */ + } } } } @@ -64,15 +63,15 @@ async function* _consumeReader( /** @ignore */ async function* defaultReaderToAsyncIterator(reader: ReadableStreamDefaultReader) { - let r: ReadableStreamReadResult; + let r: ReadableStreamDefaultReadResult; while (!(r = await reader.read()).done) { yield r.value; } } /** @ignore */ -async function* byobReaderToAsyncIterator(reader: ReadableStreamBYOBReader) { - let r: ReadableStreamReadResult; +async function* byobReaderToAsyncIterator(reader: ReadableStreamReader) { + let r: ReadableStreamDefaultReadResult; let value: number | ArrayBufferLike = yield null!; while (!(r = await readNext(reader, value, 0)).done) { value = yield r.value; @@ -81,10 +80,10 @@ async function* byobReaderToAsyncIterator(reader: ReadableStreamBYOBReader) { /** @ignore */ async function readNext( - reader: ReadableStreamBYOBReader, + reader: ReadableStreamReader, bufferOrLen: ArrayBufferLike | number, offset: number -): Promise> { +): Promise> { let size: number; let buffer: ArrayBufferLike; @@ -103,16 +102,16 @@ async function readNext( /** @ignore */ async function readInto( - reader: ReadableStreamBYOBReader, + reader: ReadableStreamReader, buffer: ArrayBufferLike, offset: number, size: number -): Promise> { +): Promise> { let innerOffset = offset; if (innerOffset >= size) { return { done: false, value: new Uint8Array(buffer, 0, size) }; } - const { done, value } = await reader.read( + const { done, value } = await (reader as any).read( new Uint8Array(buffer, innerOffset, size - innerOffset) ); if ((innerOffset += value!.byteLength) < size && !done) { @@ -124,7 +123,6 @@ async function readInto( /** * Creates an async-iterable from an existing DOM stream. * - * @export * @template TSource The type of elements in the source DOM stream. * @param {ReadableStream} stream The DOM Readable stream to convert to an async-iterable. * @returns {AsyncIterableX} An async-iterable containing the elements from the ReadableStream. @@ -133,7 +131,6 @@ export function fromDOMStream(stream: ReadableStream): AsyncIt /** * Creates an async-iterable from an existing DOM stream and options. * - * @export * @template TSource * @template TSource The type of elements in the source DOM stream. * @param {ReadableStream} stream The readable stream to convert to an async-iterable. * @param {{ mode: 'byob' }} options The options to set the mode for the DOM stream. @@ -147,13 +144,12 @@ export function fromDOMStream( /** * Creates an async-iterable from an existing DOM stream and optional options. * - * @export * @param {ReadableStream} stream The readable stream to convert to an async-iterable. * @param {{ mode: 'byob' }} [options] The optional options to set the mode for the DOM stream. * @returns {AsyncIterableX} An async-iterable created from the incoming async-iterable. */ export function fromDOMStream(stream: ReadableStream, options?: { mode: 'byob' }) { - return !options || options.mode !== 'byob' + return !options || options['mode'] !== 'byob' ? new AsyncIterableReadableStream(stream) : new AsyncIterableReadableByteStream(stream); } diff --git a/src/asynciterable/fromevent.ts b/src/asynciterable/fromevent.ts index 80e639c6..def334da 100644 --- a/src/asynciterable/fromevent.ts +++ b/src/asynciterable/fromevent.ts @@ -8,10 +8,10 @@ export interface NodeEventEmitter { export type EventListenerOptions = | { - capture?: boolean; - passive?: boolean; - once?: boolean; - } + capture?: boolean; + passive?: boolean; + once?: boolean; + } | boolean; export type EventedTarget = EventTarget | NodeEventEmitter; @@ -31,7 +31,6 @@ function isEventTarget(obj: any): obj is EventTarget { /** * Converts an event emitter event into an async-iterable stream. * - * @export * @template TSource The type of elements in the emitter stream. * @param {EventedTarget} obj The object that emits the events to turn into an async-iterable. * @param {string} type The name of the event to listen for creation of the async-iterable. diff --git a/src/asynciterable/fromeventpattern.ts b/src/asynciterable/fromeventpattern.ts index a2b1cb6f..97e9d27d 100644 --- a/src/asynciterable/fromeventpattern.ts +++ b/src/asynciterable/fromeventpattern.ts @@ -5,7 +5,6 @@ import { memoize } from './operators/memoize'; /** * Creates asnyc-iterable from an event emitter by adding handlers for both listening and unsubscribing from events. * - * @export * @template TSource The type of elements in the event emitter. * @param {(handler: (...args: any[]) => void) => void} addHandler The function to add a listener to the source. * @param {(handler: (...args: any[]) => void) => void} removeHandler The function to remove a listener from the source. diff --git a/src/asynciterable/fromnodestream.ts b/src/asynciterable/fromnodestream.ts index 85d051db..e1ec66de 100644 --- a/src/asynciterable/fromnodestream.ts +++ b/src/asynciterable/fromnodestream.ts @@ -99,7 +99,6 @@ export class ReadableStreamAsyncIterable extends AsyncIterableX /** * Creates a new async-iterable from a Node.js stream. * - * @export * @param {NodeJS.ReadableStream} stream The Node.js stream to convert to an async-iterable. * @param {number} [size] The size of the buffers for the stream. * @returns {(AsyncIterableX)} An async-iterable containing data from the stream either in string or Buffer format. diff --git a/src/asynciterable/generate.ts b/src/asynciterable/generate.ts index caafc928..9d1a7f39 100644 --- a/src/asynciterable/generate.ts +++ b/src/asynciterable/generate.ts @@ -35,7 +35,6 @@ class GenerateAsyncIterable extends AsyncIterableX { /** * Generates an async-iterable sequence by running a state-driven loop producing the sequence's elements. * - * @export * @template TState The type of the state used in the generator loop. * @template TResult The type of the elements in the produced sequence. * @param {TState} initialState The initial state. diff --git a/src/asynciterable/generatetime.ts b/src/asynciterable/generatetime.ts index 83be7e8e..7b8c2c8e 100644 --- a/src/asynciterable/generatetime.ts +++ b/src/asynciterable/generatetime.ts @@ -41,7 +41,6 @@ class GenerateTimeAsyncIterable extends AsyncIterableX /** * Generates an async-iterable sequence by running a time-based state-driven loop producing the sequence's elements. * - * @export * @template TState The type of the state used in the generator loop. * @template TResult The type of the elements in the produced sequence. * @param {TState} initialState The initial state. diff --git a/src/asynciterable/iif.ts b/src/asynciterable/iif.ts index 27d7f7ef..29469116 100644 --- a/src/asynciterable/iif.ts +++ b/src/asynciterable/iif.ts @@ -6,7 +6,6 @@ import { empty } from './empty'; * If the specified condition evaluates true, select the thenSource sequence. * Otherwise, select the elseSource sequence. * - * @export * @template TSource The type of the elements in the result sequence. * @param {((signal?: AbortSignal) => boolean | Promise)} condition Condition evaluated to decide which sequence to return. * @param {AsyncIterable} thenSource Sequence returned in case evaluates true. diff --git a/src/asynciterable/includes.ts b/src/asynciterable/includes.ts index 2ab5b58f..f944e4e1 100644 --- a/src/asynciterable/includes.ts +++ b/src/asynciterable/includes.ts @@ -5,7 +5,6 @@ import { throwIfAborted } from '../aborterror'; /** * Determines whether an async-itreable includes a certain value among its entries, returning true or false as appropriate. * - * @export * @template T The type of elements in the source sequence. * @param {AsyncIterable} source The source sequence to search for the item. * @param {T} valueToFind The value to search for. @@ -16,7 +15,7 @@ import { throwIfAborted } from '../aborterror'; export async function includes( source: AsyncIterable, valueToFind: T, - fromIndex: number = 0, + fromIndex = 0, signal?: AbortSignal ): Promise { throwIfAborted(signal); diff --git a/src/asynciterable/interval.ts b/src/asynciterable/interval.ts index 276c41d3..6ec7b375 100644 --- a/src/asynciterable/interval.ts +++ b/src/asynciterable/interval.ts @@ -23,7 +23,6 @@ class IntervalAsyncIterable extends AsyncIterableX { /** * Produces a new item in an async-iterable at the given interval cycle time. * - * @export * @param {number} dueTime The due time in milliseconds to spawn a new item. * @returns {AsyncIterableX} An async-iterable producing values at the specified interval. */ diff --git a/src/asynciterable/isempty.ts b/src/asynciterable/isempty.ts index 7fc5d40c..aab00958 100644 --- a/src/asynciterable/isempty.ts +++ b/src/asynciterable/isempty.ts @@ -4,7 +4,6 @@ import { throwIfAborted } from '../aborterror'; /** * Determines whether the given async-iterable is empty. * - * @export * @template T The type of elements in the source sequence. * @param {AsyncIterable} source The source async-iterable to determine whether it is empty. * @param {AbortSignal} [signal] An optional abort signal to cancel the operation. diff --git a/src/asynciterable/last.ts b/src/asynciterable/last.ts index c2594257..79b6aa44 100644 --- a/src/asynciterable/last.ts +++ b/src/asynciterable/last.ts @@ -6,7 +6,6 @@ import { OptionalFindOptions } from './findoptions'; * Returns the last element of an async-iterable sequence that satisfies the condition in the predicate if given * otherwise the last item in the sequence, or a default value if no such element exists. * - * @export * @template T The type of elements in the source sequence. * @param {AsyncIterable} source The source async-iterable sequence. * @param {OptionalFindOptions} [options] The options which include an optional predicate for filtering, diff --git a/src/asynciterable/mathoptions.ts b/src/asynciterable/mathoptions.ts index d6d01027..5b421430 100644 --- a/src/asynciterable/mathoptions.ts +++ b/src/asynciterable/mathoptions.ts @@ -1,7 +1,6 @@ /** * The options for calculating an average. * - * @export * @interface MathOptions * @template T The type of elements in the source sequence. */ diff --git a/src/asynciterable/max.ts b/src/asynciterable/max.ts index 6c7b6ed4..083faec0 100644 --- a/src/asynciterable/max.ts +++ b/src/asynciterable/max.ts @@ -7,7 +7,6 @@ import { throwIfAborted } from '../aborterror'; /** * Returns the maximum element with the optional selector. * - * @export * @template TSource The type of the elements in the source sequence. * @param {AsyncIterable} source An async-iterable sequence to determine the maximum element of. * @param {ExtremaByOptions} [options] The options which include an optional comparer and abort signal. diff --git a/src/asynciterable/maxby.ts b/src/asynciterable/maxby.ts index 9e50b80e..bb84e825 100644 --- a/src/asynciterable/maxby.ts +++ b/src/asynciterable/maxby.ts @@ -5,7 +5,6 @@ import { equalityComparerAsync } from '../util/comparer'; /** * Returns the elements in an async-iterable sequence with the maximum key value. * - * @export * @template TSource The type of the elements in the source sequence. * @template TKey The type of the key computed for each element in the source sequence. * @param {AsyncIterable} source An async-iterable sequence to get the maximum elements for. diff --git a/src/asynciterable/merge.ts b/src/asynciterable/merge.ts index 932ea764..4a46d6b8 100644 --- a/src/asynciterable/merge.ts +++ b/src/asynciterable/merge.ts @@ -53,7 +53,6 @@ export class MergeAsyncIterable extends AsyncIterableX { /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @param {AsyncIterable} source The first async-iterable source to merge. @@ -67,7 +66,6 @@ export function merge( /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -85,7 +83,6 @@ export function merge( /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -106,7 +103,6 @@ export function merge( /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -130,7 +126,6 @@ export function merge( /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -157,7 +152,6 @@ export function merge( /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the elements in the sequence to merge. * @param {AsyncIterable} source The first async-iterable source to merge. * @param {...AsyncIterable[]} args The async-iterable sources to merge. diff --git a/src/asynciterable/min.ts b/src/asynciterable/min.ts index 26916411..d131796e 100644 --- a/src/asynciterable/min.ts +++ b/src/asynciterable/min.ts @@ -7,7 +7,6 @@ import { throwIfAborted } from '../aborterror'; /** * * Returns the minimum element with the optional selector. * - * @export * @template TSource The type of the elements in the source sequence. * @param {AsyncIterable} source An async-iterable sequence to determine the minimum element of. * @param {ExtremaOptions} [options] The options which include an optional comparer and abort signal. diff --git a/src/asynciterable/minby.ts b/src/asynciterable/minby.ts index c3dfb607..21a693f4 100644 --- a/src/asynciterable/minby.ts +++ b/src/asynciterable/minby.ts @@ -5,7 +5,6 @@ import { equalityComparerAsync } from '../util/comparer'; /** * Returns the elements in an async-enumerable sequence with the minimum key value. * - * @export * @template TSource The type of the elements in the source sequence. * @template TKey The type of the key computed for each element in the source sequence. * @param {AsyncIterable} source An async-iterable sequence to get the minimum elements for. diff --git a/src/asynciterable/never.ts b/src/asynciterable/never.ts index 1fedc5de..90d9d6ca 100644 --- a/src/asynciterable/never.ts +++ b/src/asynciterable/never.ts @@ -19,7 +19,6 @@ export class NeverAsyncIterable extends AsyncIterableX { /** * An async-iterable sequence that never returns a value. * - * @export * @returns {AsyncIterableX} An async-iterable sequence that never returns a value. */ export function never(): AsyncIterableX { diff --git a/src/asynciterable/of.ts b/src/asynciterable/of.ts index ed38e129..363b8481 100644 --- a/src/asynciterable/of.ts +++ b/src/asynciterable/of.ts @@ -20,7 +20,6 @@ export class OfAsyncIterable extends AsyncIterableX { /** * Creates an async-iterable from the specified elements. * - * @export * @template TSource The type of the elements to create an async-iterable sequence. * @param {...TSource[]} args The elements to turn into an async-iterable sequence. * @returns {AsyncIterableX} The async-iterable sequence created from the elements. diff --git a/src/asynciterable/onerrorresumenext.ts b/src/asynciterable/onerrorresumenext.ts index 9901842c..817c58c7 100644 --- a/src/asynciterable/onerrorresumenext.ts +++ b/src/asynciterable/onerrorresumenext.ts @@ -34,7 +34,6 @@ export class OnErrorResumeNextAsyncIterable extends AsyncIterableX[]} args Async-iterable sequences to concatenate. * @returns {AsyncIterableX} An async-iterable sequence that concatenates the source sequences, even if a sequence terminates exceptionally. diff --git a/src/asynciterable/operators/batch.ts b/src/asynciterable/operators/batch.ts index 4126998a..d51442ee 100644 --- a/src/asynciterable/operators/batch.ts +++ b/src/asynciterable/operators/batch.ts @@ -4,7 +4,7 @@ import { wrapWithAbort } from './withabort'; import { throwIfAborted } from '../../aborterror'; interface AsyncResolver { - resolve: (value?: T | PromiseLike | undefined) => void; + resolve: (value: T | PromiseLike) => void; reject: (reason?: any) => void; } @@ -117,7 +117,6 @@ export class BatchAsyncIterable extends AsyncIterableX { Returns an async iterable sequence of batches that are collected from the source sequence between * subsequent `next()` calls. * - * @export * @template TSource The type of elements in the source sequence. * @returns {OperatorAsyncFunction} An operator returning an async-iterable of batches that are collection from the * source sequence between subsequent `next()` calls. diff --git a/src/asynciterable/operators/buffer.ts b/src/asynciterable/operators/buffer.ts index 31ef50df..864ef613 100644 --- a/src/asynciterable/operators/buffer.ts +++ b/src/asynciterable/operators/buffer.ts @@ -45,7 +45,6 @@ export class BufferAsyncIterable extends AsyncIterableX { * Projects each element of an async-iterable sequence into consecutive non-overlapping * buffers which are produced based on element count information. * - * @export * @template TSource The type of elements in the source sequence. * @param {number} count The length of each buffer. * @param {number} [skip] An optional number of elements to skip between creation of consecutive buffers. diff --git a/src/asynciterable/operators/buffercountortime.ts b/src/asynciterable/operators/buffercountortime.ts index f1294610..9a42c2ce 100644 --- a/src/asynciterable/operators/buffercountortime.ts +++ b/src/asynciterable/operators/buffercountortime.ts @@ -45,7 +45,6 @@ class BufferCountOrTime extends AsyncIterableX { * Projects each element of an async-iterable sequence into consecutive buffers * which are emitted when either the threshold count or time is met. * - * @export * @template TSource The type of elements in the source sequence. * @param {number} count The size of the buffer. * @param {number} time The threshold number of milliseconds to wait before flushing a non-full buffer diff --git a/src/asynciterable/operators/catcherror.ts b/src/asynciterable/operators/catcherror.ts index 47966d8c..08441900 100644 --- a/src/asynciterable/operators/catcherror.ts +++ b/src/asynciterable/operators/catcherror.ts @@ -60,7 +60,6 @@ export class CatchWithAsyncIterable extends AsyncIterableX} source First async-iterable source. @@ -19,7 +18,6 @@ export function combineLatestWith( * Merges multiple async-iterable sequences into one async-iterable sequence as an array whenever * one of the async-iterable sequences produces an element. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -35,7 +33,6 @@ export function combineLatestWith( * Merges multiple async-iterable sequences into one async-iterable sequence as an array whenever * one of the async-iterable sequences produces an element. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -54,7 +51,6 @@ export function combineLatestWith( * Merges multiple async-iterable sequences into one async-iterable sequence as an array whenever * one of the async-iterable sequences produces an element. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -76,7 +72,6 @@ export function combineLatestWith( * Merges multiple async-iterable sequences into one async-iterable sequence as an array whenever * one of the async-iterable sequences produces an element. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -102,7 +97,6 @@ export function combineLatestWith( * Merges multiple async-iterable sequences into one async-iterable sequence as an array whenever * one of the async-iterable sequences produces an element. * - * @export * @template T The of the elements in the source sequences. * @param {...AsyncIterable[]} sources The async-iterable sources. * @returns {OperatorAsyncFunction} An async-iterable sequence containing an array of all sources. diff --git a/src/asynciterable/operators/concatall.ts b/src/asynciterable/operators/concatall.ts index 1e4b9be9..4632c128 100644 --- a/src/asynciterable/operators/concatall.ts +++ b/src/asynciterable/operators/concatall.ts @@ -25,7 +25,6 @@ export class ConcatAllAsyncIterable extends AsyncIterableX { * Concatenates all inner async-iterable sequences, as long as the previous * async-iterable sequence terminated successfully. * - * @export * @template T The type of elements in the source sequence. * @returns {OperatorAsyncFunction, T>} An operator which concatenates all inner async-iterable sources. */ diff --git a/src/asynciterable/operators/concatwith.ts b/src/asynciterable/operators/concatwith.ts index 2b691d5b..d15918f1 100644 --- a/src/asynciterable/operators/concatwith.ts +++ b/src/asynciterable/operators/concatwith.ts @@ -4,7 +4,6 @@ import { ConcatAsyncIterable } from '../concat'; /** * Concatenates the second async-iterable sequence to the first async-iterable sequence upon successful termination of the first. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @param {AsyncIterable} v1 First async-iterable source. @@ -17,7 +16,6 @@ export function concatWith(v2: AsyncIterable): OperatorAsyncFunction< * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -35,7 +33,6 @@ export function concatWith( * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -55,7 +52,6 @@ export function concatWith( * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -78,7 +74,6 @@ export function concatWith( * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -105,7 +100,6 @@ export function concatWith( * Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the sequences. * @param {...AsyncIterable[]} args The async-iterable sources. * @returns {AsyncIterableX} An async-iterable sequence that contains the elements of each given sequence, in sequential order. diff --git a/src/asynciterable/operators/debounce.ts b/src/asynciterable/operators/debounce.ts index ce7df4bf..b8e8ef36 100644 --- a/src/asynciterable/operators/debounce.ts +++ b/src/asynciterable/operators/debounce.ts @@ -18,7 +18,7 @@ export class DebounceAsyncIterable extends AsyncIterableX { let reject: (reason?: any) => void = () => { /**/ }; - let resolve: (value?: TSource | PromiseLike) => void = () => { + let resolve: (value: TSource | PromiseLike) => void = () => { /**/ }; let promise = new Promise((r1, r2) => { @@ -81,7 +81,6 @@ export class DebounceAsyncIterable extends AsyncIterableX { * Emits a notification from the source async-iterable only after a particular time span * has passed without another source emission. * - * @export * @template TSource The type of elements in the source sequence. * @param {number} time The timeout duration in milliseconds * @returns {MonoTypeOperatorAsyncFunction} An operator function which debounces by the given timeout. diff --git a/src/asynciterable/operators/defaultifempty.ts b/src/asynciterable/operators/defaultifempty.ts index 21dbd967..b8c839bb 100644 --- a/src/asynciterable/operators/defaultifempty.ts +++ b/src/asynciterable/operators/defaultifempty.ts @@ -30,7 +30,6 @@ export class DefaultIfEmptyAsyncIterable extends AsyncIterableX} An operator which returns the elements of the source sequence or the default value as a singleton. diff --git a/src/asynciterable/operators/delay.ts b/src/asynciterable/operators/delay.ts index 96dcbce5..50996cc8 100644 --- a/src/asynciterable/operators/delay.ts +++ b/src/asynciterable/operators/delay.ts @@ -26,7 +26,6 @@ export class DelayAsyncIterable extends AsyncIterableX { /** * Delays the emitting of the first item in the async-iterable by the given due time. * - * @export * @template TSource The type of elements in the source sequence. * @param {number} dueTime The delay duration in milliseconds * @returns {MonoTypeOperatorAsyncFunction} An operator which delays the before the iteration begins. diff --git a/src/asynciterable/operators/delayeach.ts b/src/asynciterable/operators/delayeach.ts index e839877c..2bb7d571 100644 --- a/src/asynciterable/operators/delayeach.ts +++ b/src/asynciterable/operators/delayeach.ts @@ -26,7 +26,6 @@ export class DelayEachAsyncIterable extends AsyncIterableX { /** * Delays the emitting of each items in the async-iterable by the given due time. * - * @export * @template TSource The type of elements in the source sequence. * @param {number} dueTime The delay duration in milliseconds * @returns {MonoTypeOperatorAsyncFunction} An operator which takes an async-iterable and delays each item in the sequence by the given time. diff --git a/src/asynciterable/operators/distinct.ts b/src/asynciterable/operators/distinct.ts index 4afef431..785f4e75 100644 --- a/src/asynciterable/operators/distinct.ts +++ b/src/asynciterable/operators/distinct.ts @@ -40,7 +40,6 @@ export class DistinctAsyncIterable extends AsyncIterabl /** * Returns an async-iterable sequence that contains only distinct elements according to the keySelector and comparer. * - * @export * @template TSource The type of the elements in the source sequence. * @template TKey The type of the discriminator key computed for each element in the source sequence. * @param {DistinctOptions} [options] The optional arguments for a key selector and comparer function. diff --git a/src/asynciterable/operators/distinctoptions.ts b/src/asynciterable/operators/distinctoptions.ts index 62999f7b..1357ab79 100644 --- a/src/asynciterable/operators/distinctoptions.ts +++ b/src/asynciterable/operators/distinctoptions.ts @@ -1,7 +1,6 @@ /** * This class holds the options for the distinct operator including a key selector and comparer. * - * @export * @interface DistinctOptions * @template TSource The type of the elements in the source sequence. * @template TKey The type of the discriminator key computed for each element in the source sequence. diff --git a/src/asynciterable/operators/distinctuntilchanged.ts b/src/asynciterable/operators/distinctuntilchanged.ts index a00cd5c4..aeb3ab22 100644 --- a/src/asynciterable/operators/distinctuntilchanged.ts +++ b/src/asynciterable/operators/distinctuntilchanged.ts @@ -7,7 +7,7 @@ import { throwIfAborted } from '../../aborterror'; import { DistinctOptions } from './distinctoptions'; export class DistinctUntilChangedAsyncIterable extends AsyncIterableX< -TSource + TSource > { private _source: AsyncIterable; private _keySelector: (value: TSource, signal?: AbortSignal) => TKey | Promise; @@ -46,7 +46,6 @@ TSource /** * Returns an async-iterable sequence that contains only distinct contiguous elements according to the optional keySelector and comparer. * - * @export * @template TSource The type of the elements in the source sequence. * @template TKey The type of the discriminator key computed for each element in the source sequence. * @param {DistinctOptions} [options] The optional options for adding a key selector and comparer. diff --git a/src/asynciterable/operators/dowhile.ts b/src/asynciterable/operators/dowhile.ts index 611f2496..2d5afafb 100644 --- a/src/asynciterable/operators/dowhile.ts +++ b/src/asynciterable/operators/dowhile.ts @@ -6,7 +6,6 @@ import { MonoTypeOperatorAsyncFunction } from '../../interfaces'; /** * Generates an async-iterable sequence by repeating a source sequence as long as the given loop postcondition holds. * - * @export * @template TSource The type of elements in the source sequence. * @param {((signal?: AbortSignal) => boolean | Promise)} condition Loop condition. * @returns {MonoTypeOperatorAsyncFunction} An operator that generates an async-iterable by repeating a diff --git a/src/asynciterable/operators/endwith.ts b/src/asynciterable/operators/endwith.ts index 7c0e1753..0cc22c9f 100644 --- a/src/asynciterable/operators/endwith.ts +++ b/src/asynciterable/operators/endwith.ts @@ -27,7 +27,6 @@ export class EndWithAsyncIterable extends AsyncIterableX { /** * Append values to an async-iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @param {...TSource[]} args The values to append to the end of the async-iterable sequence. * @returns {MonoTypeOperatorAsyncFunction} An operator which appends values to the end of the sequence. diff --git a/src/asynciterable/operators/except.ts b/src/asynciterable/operators/except.ts index f80fe1ef..b74d4b1b 100644 --- a/src/asynciterable/operators/except.ts +++ b/src/asynciterable/operators/except.ts @@ -40,7 +40,6 @@ export class ExceptAsyncIterable extends AsyncIterableX { /** * Produces the set difference of two async-iterable sequences by using the specified equality comparer to compare values. * - * @export * @template TSource The type of the elements of the input sequences. * @param {AsyncIterable} second An async-iterable sequence whose elements that also occur in the * operator sequence will cause those elements to be removed from the returned sequence. diff --git a/src/asynciterable/operators/expand.ts b/src/asynciterable/operators/expand.ts index 603faa0d..d40b4d20 100644 --- a/src/asynciterable/operators/expand.ts +++ b/src/asynciterable/operators/expand.ts @@ -39,7 +39,6 @@ export class ExpandAsyncIterable extends AsyncIterableX { /** * Expands (breadth first) the async-iterable sequence by recursively applying a selector function to generate more sequences at each recursion level. * - * @export * @template TSource Source sequence element type. * @param {(( * value: TSource, diff --git a/src/asynciterable/operators/filter.ts b/src/asynciterable/operators/filter.ts index 04dd5072..43c687c1 100644 --- a/src/asynciterable/operators/filter.ts +++ b/src/asynciterable/operators/filter.ts @@ -42,7 +42,6 @@ export function filter( /** * Filters the elements of an async-iterable sequence based on a predicate. * - * @export * @template TSource The type of the elements in the source sequence. * @param {((value: TSource, index: number, signal?: AbortSignal) => boolean | Promise)} predicate A function to test each source element * for a condition. diff --git a/src/asynciterable/operators/finalize.ts b/src/asynciterable/operators/finalize.ts index 9c802d34..b78e50b9 100644 --- a/src/asynciterable/operators/finalize.ts +++ b/src/asynciterable/operators/finalize.ts @@ -28,7 +28,6 @@ export class FinallyAsyncIterable extends AsyncIterableX { /** * Invokes a specified asynchronous action after the source async-iterable sequence terminates gracefully or exceptionally. * - * @export * @template TSource The type of the elements in the source sequence. * @param {(() => void | Promise)} action Action to invoke and await asynchronously after the source async-iterable sequence terminates * @returns {MonoTypeOperatorAsyncFunction} An operator that returns the source sequence with the diff --git a/src/asynciterable/operators/flat.ts b/src/asynciterable/operators/flat.ts index 04c81942..2a20729c 100644 --- a/src/asynciterable/operators/flat.ts +++ b/src/asynciterable/operators/flat.ts @@ -46,12 +46,11 @@ export class FlattenAsyncIterable extends AsyncIterableX { /** * Flattens the nested async-iterable by the given depth. * - * @export * @template T The type of elements in the source sequence. * @param {number} [depth=Infinity] The depth to flatten the async-iterable sequence if specified, otherwise infinite. * @returns {MonoTypeOperatorAsyncFunction} An operator that flattens the async-iterable sequence. */ -export function flat(depth: number = Infinity): MonoTypeOperatorAsyncFunction { +export function flat(depth = Infinity): MonoTypeOperatorAsyncFunction { return function flattenOperatorFunction(source: AsyncIterable): AsyncIterableX { return new FlattenAsyncIterable(source, depth); }; diff --git a/src/asynciterable/operators/flatmap.ts b/src/asynciterable/operators/flatmap.ts index 6675773f..36c58ada 100644 --- a/src/asynciterable/operators/flatmap.ts +++ b/src/asynciterable/operators/flatmap.ts @@ -44,7 +44,6 @@ export class FlatMapAsyncIterable extends AsyncIterableX extends AsyncIterableX { } export class GroupByAsyncIterable extends AsyncIterableX< -GroupedAsyncIterable + GroupedAsyncIterable > { private _source: AsyncIterable; private _keySelector: (value: TSource, signal?: AbortSignal) => TKey | Promise; @@ -64,7 +64,6 @@ export function groupBy( /** * Groups the elements of an async-iterable sequence and selects the resulting elements by using a specified function. * - * @export * @template TSource The type of the elements in the source sequence. * @template TKey The type of the grouping key computed for each element in the source sequence. * @template TValue The type of the elements within the groups computed for each element in the source sequence. diff --git a/src/asynciterable/operators/groupjoin.ts b/src/asynciterable/operators/groupjoin.ts index 4e348066..5bbfd285 100644 --- a/src/asynciterable/operators/groupjoin.ts +++ b/src/asynciterable/operators/groupjoin.ts @@ -51,7 +51,6 @@ export class GroupJoinAsyncIterable extends Async /** * Correlates the elements of two async-iterable sequences based on equality of keys and groups the results. * - * @export * @template TOuter The type of the elements of the first async-iterable sequence. * @template TInner The type of the elements of the second async-iterable sequence. * @template TKey The type of the keys returned by the key selector functions. diff --git a/src/asynciterable/operators/ignoreelements.ts b/src/asynciterable/operators/ignoreelements.ts index 7c778562..54b3dc55 100644 --- a/src/asynciterable/operators/ignoreelements.ts +++ b/src/asynciterable/operators/ignoreelements.ts @@ -22,7 +22,6 @@ export class IgnoreElementsAsyncIterable extends AsyncIterableX} An operator that returns an empty async-iterable sequence * that signals termination, successful or exceptional, of the source sequence. diff --git a/src/asynciterable/operators/innerjoin.ts b/src/asynciterable/operators/innerjoin.ts index 84840e16..49b430a5 100644 --- a/src/asynciterable/operators/innerjoin.ts +++ b/src/asynciterable/operators/innerjoin.ts @@ -52,7 +52,6 @@ export class JoinAsyncIterable extends AsyncItera /** * Correlates the elements of two sequences based on matching keys. * - * @export * @template TOuter The type of the elements of the first async-iterable sequence. * @template TInner The type of the elements of the second async-iterable sequence. * @template TKey The type of the keys returned by the key selector functions. diff --git a/src/asynciterable/operators/intersect.ts b/src/asynciterable/operators/intersect.ts index ccfca4dc..de50604b 100644 --- a/src/asynciterable/operators/intersect.ts +++ b/src/asynciterable/operators/intersect.ts @@ -53,7 +53,6 @@ export class IntersectAsyncIterable extends AsyncIterableX { /** * Produces the set intersection of two async-iterable sequences. * - * @export * @template TSource The type of the elements of the input sequences. * @param {AsyncIterable} second An async-iterable sequence whose distinct elements that also * appear in the first sequence will be returned. diff --git a/src/asynciterable/operators/map.ts b/src/asynciterable/operators/map.ts index 4a4334e9..7cdaf093 100644 --- a/src/asynciterable/operators/map.ts +++ b/src/asynciterable/operators/map.ts @@ -36,7 +36,6 @@ export class MapAsyncIterable extends AsyncIterableX /** * Projects each element of an async-enumerable sequence into a new form. * - * @export * @template TSource The type of the elements in the source sequence. * @template TResult The type of the elements in the result sequence, obtained by running the selector * function for each element in the source sequence. diff --git a/src/asynciterable/operators/memoize.ts b/src/asynciterable/operators/memoize.ts index 7bbfeda6..bc3e1984 100644 --- a/src/asynciterable/operators/memoize.ts +++ b/src/asynciterable/operators/memoize.ts @@ -74,7 +74,6 @@ export class MemoizeAsyncBuffer extends AsyncIterableX { /** * Creates a buffer with a view over the source sequence, causing a specified number of iterators to obtain access * to all of the sequence's elements without causing multiple enumerations over the source. - * @export * @template TSource Source sequence element type. * @param {number} [readerCount] Number of iterators that can access the underlying buffer. * Once every iterator has obtained an element from the buffer, the element is removed from the buffer. @@ -86,7 +85,6 @@ export function memoize(readerCount?: number): OperatorAsyncFunction( * Memoizes the source sequence within a selector function where a specified number of iterators can get access * to all of the sequence's elements without causing multiple iterations over the source. * - * @export * @template TSource Source sequence element type. * @template TResult Result sequence element type. * @param {number} [readerCount=-1] Number of iterators that can access the underlying buffer. Once every @@ -115,7 +112,7 @@ export function memoize( * memoized view over the source sequence. */ export function memoize( - readerCount: number = -1, + readerCount = -1, selector?: (value: AsyncIterable) => AsyncIterable ): OperatorAsyncFunction { return function memoizeOperatorFunction( @@ -124,13 +121,13 @@ export function memoize( if (!selector) { return readerCount === -1 ? new MemoizeAsyncBuffer( - source[Symbol.asyncIterator](), - new MaxRefCountList() - ) + source[Symbol.asyncIterator](), + new MaxRefCountList() + ) : new MemoizeAsyncBuffer( - source[Symbol.asyncIterator](), - new RefCountList(readerCount) - ); + source[Symbol.asyncIterator](), + new RefCountList(readerCount) + ); } return create(() => selector!(memoize(readerCount)(source))[Symbol.asyncIterator]() diff --git a/src/asynciterable/operators/mergeall.ts b/src/asynciterable/operators/mergeall.ts index ba5cc22e..ce4d83a8 100644 --- a/src/asynciterable/operators/mergeall.ts +++ b/src/asynciterable/operators/mergeall.ts @@ -6,7 +6,6 @@ import { OperatorAsyncFunction } from '../../interfaces'; /** * Merges elements from all inner async-iterable sequences into a single async-iterable sequence. * - * @export * @template TSource The type of the elements in the source sequences. * @returns {OperatorAsyncFunction, TSource>} The async-iterable sequence that merges the elements of the inner sequences. */ diff --git a/src/asynciterable/operators/mergewith.ts b/src/asynciterable/operators/mergewith.ts index e9a5307e..ca986945 100644 --- a/src/asynciterable/operators/mergewith.ts +++ b/src/asynciterable/operators/mergewith.ts @@ -4,7 +4,6 @@ import { MergeAsyncIterable } from '../merge'; /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @param {AsyncIterable} source The first async-iterable source to merge. @@ -16,7 +15,6 @@ export function mergeWith(v2: AsyncIterable): OperatorAsyncFunction( /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -52,7 +49,6 @@ export function mergeWith( /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -74,7 +70,6 @@ export function mergeWith( /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -99,7 +94,6 @@ export function mergeWith( /** * Merges elements from all of the specified async-iterable sequences into a single async-iterable sequence. * - * @export * @template T The type of the elements in the sequence to merge. * @param {...AsyncIterable[]} args The async-iterable sources to merge. * @returns {AsyncIterableX} The merged elements from all of the specified async-iterable sequences into a single async-iterable sequence. diff --git a/src/asynciterable/operators/orderby.ts b/src/asynciterable/operators/orderby.ts index 79b50545..2fec9d24 100644 --- a/src/asynciterable/operators/orderby.ts +++ b/src/asynciterable/operators/orderby.ts @@ -104,7 +104,6 @@ export class OrderedAsyncIterableX extends OrderedAsyncIterableBa /** * Sorts the elements of a sequence in ascending order according to a key by using a specified comparer. * - * @export * @template TKey The type of the elements of source. * @template TSource The type of the key returned by keySelector. * @param {(item: TSource) => TKey} keySelector A function to extract a key from an element. @@ -124,7 +123,6 @@ export function orderBy( /** * Sorts the elements of a sequence in descending order according to a key by using a specified comparer. * - * @export * @template TKey The type of the elements of source. * @template TSource The type of the key returned by keySelector. * @param {(item: TSource) => TKey} keySelector A function to extract a key from an element. @@ -144,7 +142,6 @@ export function orderByDescending( /** * Performs a subsequent ordering of the elements in a sequence in ascending order according to a key using a specified comparer. * - * @export * @template TKey The type of the elements of source. * @template TSource The type of the key returned by keySelector. * @param {(item: TSource) => TKey} keySelector A function to extract a key from an element. @@ -171,7 +168,6 @@ export function thenBy( /** * Performs a subsequent ordering of the elements in a sequence in descending order according to a key using a specified comparer. * - * @export * @template TKey The type of the elements of source. * @template TSource The type of the key returned by keySelector. * @param {(item: TSource) => TKey} keySelector A function to extract a key from an element. diff --git a/src/asynciterable/operators/pairwise.ts b/src/asynciterable/operators/pairwise.ts index fed5e78c..d195fd24 100644 --- a/src/asynciterable/operators/pairwise.ts +++ b/src/asynciterable/operators/pairwise.ts @@ -30,7 +30,6 @@ export class PairwiseAsyncIterable extends AsyncIterableX { * Returns a sequence of each element in the input sequence and its predecessor, with the exception of the * first element which is only returned as the predecessor of the second element. * - * @export * @template TSource The type of the elements in the source sequence. * @returns {OperatorAsyncFunction} The result sequence. */ diff --git a/src/asynciterable/operators/pluck.ts b/src/asynciterable/operators/pluck.ts index 31c89c52..b6a5dc49 100644 --- a/src/asynciterable/operators/pluck.ts +++ b/src/asynciterable/operators/pluck.ts @@ -22,7 +22,6 @@ function plucker(props: string[], length: number): (x: any) => any { /** * Maps each source value to its specified nested property. * - * @export * @template TSource The type of the elements in the source sequence. * @template TResult The type of the elements in the result sequence, obtained by the property names. * @param {...string[]} args The nested properties to pluck from each source value. diff --git a/src/asynciterable/operators/publish.ts b/src/asynciterable/operators/publish.ts index fc846c5b..08f9e484 100644 --- a/src/asynciterable/operators/publish.ts +++ b/src/asynciterable/operators/publish.ts @@ -6,8 +6,7 @@ import { MemoizeAsyncBuffer } from './memoize'; import { throwIfAborted } from '../../aborterror'; class PublishedAsyncBuffer extends MemoizeAsyncBuffer { - // @ts-ignore - protected _buffer: RefCountList; + protected declare _buffer: RefCountList; constructor(source: AsyncIterator) { super(source, new RefCountList(0)); @@ -24,7 +23,6 @@ class PublishedAsyncBuffer extends MemoizeAsyncBuffer { * Creates a buffer with a view over the source sequence, causing each iterator to obtain access to the * remainder of the sequence from the current index in the buffer. * - * @export * @template TSource Source sequence element type. * @returns {OperatorAsyncFunction} Buffer enabling each iterator to retrieve elements from * the shared source sequence, starting from the index at the point of obtaining the enumerator. @@ -34,7 +32,6 @@ export function publish(): OperatorAsyncFunction; * Buffer enabling each iterator to retrieve elements from the shared source sequence, starting from the * index at the point of obtaining the iterator. * - * @export * @template TSource Source sequence element type. * @template TResult Result sequence element type. * @param {(value: AsyncIterable) => AsyncIterable} [selector] Selector function with published @@ -49,7 +46,6 @@ export function publish( * Buffer enabling each iterator to retrieve elements from the shared source sequence, starting from the * index at the point of obtaining the iterator. * - * @export * @template TSource Source sequence element type. * @template TResult Result sequence element type. * @param {(value: AsyncIterable) => AsyncIterable} [selector] Selector function with published diff --git a/src/asynciterable/operators/racewith.ts b/src/asynciterable/operators/racewith.ts index 37f1a08e..c2831b64 100644 --- a/src/asynciterable/operators/racewith.ts +++ b/src/asynciterable/operators/racewith.ts @@ -4,7 +4,6 @@ import { RaceAsyncIterable } from '../race'; /** * Propagates the async sequence that reacts first. * - * @export * @param {...AsyncIterable[]} sources The source sequences. * @return {MonoTypeOperatorAsyncFunction } An async sequence that surfaces either of the given sequences, whichever reacted first. */ diff --git a/src/asynciterable/operators/repeat.ts b/src/asynciterable/operators/repeat.ts index 238dc6e7..b8dda560 100644 --- a/src/asynciterable/operators/repeat.ts +++ b/src/asynciterable/operators/repeat.ts @@ -34,12 +34,11 @@ export class RepeatAsyncIterable extends AsyncIterableX { /** * Repeats the async-enumerable sequence a specified number of times. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} [count=-1] Number of times to repeat the sequence. If not specified, the sequence repeats indefinitely. * @returns {MonoTypeOperatorAsyncFunction} The async-iterable sequence producing the elements of the given sequence repeatedly. */ -export function repeat(count: number = -1): MonoTypeOperatorAsyncFunction { +export function repeat(count = -1): MonoTypeOperatorAsyncFunction { return function repeatOperatorFunction(source: AsyncIterable): AsyncIterableX { return new RepeatAsyncIterable(source, count); }; diff --git a/src/asynciterable/operators/retry.ts b/src/asynciterable/operators/retry.ts index 49aabb53..2d73dfdb 100644 --- a/src/asynciterable/operators/retry.ts +++ b/src/asynciterable/operators/retry.ts @@ -6,13 +6,12 @@ import { MonoTypeOperatorAsyncFunction } from '../../interfaces'; /** * Retries the async-iterable instance the number of given times. If not supplied, it will try infinitely. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} [count=-1] An optional number of times to retry, otherwise is set to infinite retries * @returns {MonoTypeOperatorAsyncFunction} An async-iterable sequence producing the elements of the * given sequence repeatedly until it terminates successfully. */ -export function retry(count: number = -1): MonoTypeOperatorAsyncFunction { +export function retry(count = -1): MonoTypeOperatorAsyncFunction { return function retryOperatorFunction(source: AsyncIterable): AsyncIterableX { return new CatchAllAsyncIterable(repeatValue>(source, count)); }; diff --git a/src/asynciterable/operators/reverse.ts b/src/asynciterable/operators/reverse.ts index 63409d40..6815763c 100644 --- a/src/asynciterable/operators/reverse.ts +++ b/src/asynciterable/operators/reverse.ts @@ -24,7 +24,6 @@ export class ReverseAsyncIterable extends AsyncIterableX { /** * Reverses the async-iterable instance. * - * @export * @template TSource The type of the elements in the source sequence. * @returns {MonoTypeOperatorAsyncFunction} The async-iterable in reversed sequence. */ diff --git a/src/asynciterable/operators/scan.ts b/src/asynciterable/operators/scan.ts index 72d047b4..5a9016eb 100644 --- a/src/asynciterable/operators/scan.ts +++ b/src/asynciterable/operators/scan.ts @@ -43,7 +43,6 @@ export class ScanAsyncIterable extends AsyncIterableX { * Applies an accumulator function over an async-iterable sequence and returns each intermediate result. * The specified seed value, if given, is used as the initial accumulator value. * - * @export * @template T The type of the elements in the source sequence. * @template R The type of the result of the aggregation. * @param {ScanOptions} options The options including the accumulator function and seed. diff --git a/src/asynciterable/operators/scanoptions.ts b/src/asynciterable/operators/scanoptions.ts index 3e4e1217..13ac00a6 100644 --- a/src/asynciterable/operators/scanoptions.ts +++ b/src/asynciterable/operators/scanoptions.ts @@ -1,7 +1,6 @@ /** * The options for performing a scan operation, including the callback and the optional seed. * - * @export * @interface ScanOptions * @template T The type of the elements in the source sequence. * @template R The type of the result for the reducer callback. diff --git a/src/asynciterable/operators/scanright.ts b/src/asynciterable/operators/scanright.ts index 62de82aa..6928e5c5 100644 --- a/src/asynciterable/operators/scanright.ts +++ b/src/asynciterable/operators/scanright.ts @@ -40,7 +40,6 @@ export class ScanRightAsyncIterable extends AsyncIterableX { * Applies an accumulator function over an async-iterable sequence from the right and returns each intermediate result. * The specified seed value, if given, is used as the initial accumulator value. * - * @export * @template T The type of the elements in the source sequence. * @template R The type of the result of the aggregation. * @param {ScanOptions} options The options including the accumulator function and seed. diff --git a/src/asynciterable/operators/share.ts b/src/asynciterable/operators/share.ts index 5bffa31a..ee8192b6 100644 --- a/src/asynciterable/operators/share.ts +++ b/src/asynciterable/operators/share.ts @@ -25,7 +25,6 @@ class SharedAsyncIterable extends AsyncIterableX { * Creates a buffer with a shared view over the source sequence, causing each iterator to fetch the next element * from the source sequence. * - * @export * @template TSource Source sequence element type. * @returns {OperatorAsyncFunction} Buffer enabling each enumerator to retrieve elements from the shared source sequence. */ @@ -34,7 +33,6 @@ export function share(): OperatorAsyncFunction; * Shares the source sequence within a selector function where each iterator can fetch the next element from the * source sequence. * - * @export * @template TSource Source sequence element type. * @template TResult Result sequence element type. * @param {(( @@ -55,7 +53,6 @@ export function share( * Shares the source sequence within a selector function where each iterator can fetch the next element from the * source sequence. * - * @export * @template TSource Source sequence element type. * @template TResult Result sequence element type. * @param {(( @@ -77,12 +74,12 @@ export function share( ): AsyncIterableX { return selector ? create(async (signal) => { - const it = await selector( - new SharedAsyncIterable(source[Symbol.asyncIterator](signal)), - signal - ); - return it[Symbol.asyncIterator](signal); - }) + const it = await selector( + new SharedAsyncIterable(source[Symbol.asyncIterator](signal)), + signal + ); + return it[Symbol.asyncIterator](signal); + }) : new SharedAsyncIterable(source[Symbol.asyncIterator]()); }; } diff --git a/src/asynciterable/operators/skip.ts b/src/asynciterable/operators/skip.ts index 35cccd63..3d0148c9 100644 --- a/src/asynciterable/operators/skip.ts +++ b/src/asynciterable/operators/skip.ts @@ -33,7 +33,6 @@ export class SkipAsyncIterable extends AsyncIterableX { /** * Bypasses a specified number of elements in an async-iterable sequence and then returns the remaining elements. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} count The number of elements to skip before returning the remaining elements. * @returns {MonoTypeOperatorAsyncFunction} An async-iterable sequence that contains the elements that diff --git a/src/asynciterable/operators/skiplast.ts b/src/asynciterable/operators/skiplast.ts index d41138bd..35990f62 100644 --- a/src/asynciterable/operators/skiplast.ts +++ b/src/asynciterable/operators/skiplast.ts @@ -28,7 +28,6 @@ export class SkipLastAsyncIterable extends AsyncIterableX { /** * Bypasses a specified number of elements at the end of an async-iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} count Number of elements to bypass at the end of the source sequence. * @returns {MonoTypeOperatorAsyncFunction} An async-iterable sequence containing the diff --git a/src/asynciterable/operators/skipuntil.ts b/src/asynciterable/operators/skipuntil.ts index 102c0e14..577fc82d 100644 --- a/src/asynciterable/operators/skipuntil.ts +++ b/src/asynciterable/operators/skipuntil.ts @@ -28,7 +28,6 @@ export class SkipUntilAsyncIterable extends AsyncIterableX { /** * Returns the elements from the source observable sequence only after the function that returns a promise produces an element. * - * @export * @template TSource The type of the elements in the source sequence. * @param {(signal?: AbortSignal) => Promise} other A function which returns a promise that triggers propagation * of elements of the source sequence. diff --git a/src/asynciterable/operators/skipwhile.ts b/src/asynciterable/operators/skipwhile.ts index 4a1f9d11..f96ff550 100644 --- a/src/asynciterable/operators/skipwhile.ts +++ b/src/asynciterable/operators/skipwhile.ts @@ -39,7 +39,6 @@ export class SkipWhileAsyncIterable extends AsyncIterableX { * Bypasses elements in an async-iterale sequence as long as a specified condition is true * and then returns the remaining elements. * - * @export * @template T The type of the elements in the source sequence. * @template S The result of the predicate that is truthy/falsy. * @param {(value: T, index: number, signal?: AbortSignal) => value is S} predicate A function to test each element for a condition. @@ -53,7 +52,6 @@ export function skipWhile( * Bypasses elements in an async-iterale sequence as long as a specified condition is true * and then returns the remaining elements. * - * @export * @template T The type of the elements in the source sequence. * @param {((value: T, index: number, signal?: AbortSignal) => boolean | Promise)} predicate A function to test each element for a condition. * @returns {OperatorAsyncFunction} An async-iterable sequence that contains the elements from the input @@ -66,7 +64,6 @@ export function skipWhile( * Bypasses elements in an async-iterale sequence as long as a specified condition is true * and then returns the remaining elements. * - * @export * @template T The type of the elements in the source sequence. * @param {((value: T, index: number, signal?: AbortSignal) => boolean | Promise)} predicate A function to test each element for a condition. * @returns {OperatorAsyncFunction} An async-iterable sequence that contains the elements from the input diff --git a/src/asynciterable/operators/slice.ts b/src/asynciterable/operators/slice.ts index 93efcffd..e628439a 100644 --- a/src/asynciterable/operators/slice.ts +++ b/src/asynciterable/operators/slice.ts @@ -40,7 +40,6 @@ export class SliceAsyncIterable extends AsyncIterableX { /** * Returns the elements from the source async-iterable sequence only after the function that returns a promise produces an element. * - * @export * @template TSource The type of elements in the source sequence. * @param {number} begin Zero-based index at which to begin extraction. * @param {number} [end=Infinity] Zero-based index before which to end extraction. @@ -48,7 +47,7 @@ export class SliceAsyncIterable extends AsyncIterableX { */ export function slice( begin: number, - end: number = Infinity + end = Infinity ): MonoTypeOperatorAsyncFunction { return function sliceOperatorFunction(source: AsyncIterable): AsyncIterableX { return new SliceAsyncIterable(source, begin, end); diff --git a/src/asynciterable/operators/startwith.ts b/src/asynciterable/operators/startwith.ts index f8396be8..5d6a5491 100644 --- a/src/asynciterable/operators/startwith.ts +++ b/src/asynciterable/operators/startwith.ts @@ -27,7 +27,6 @@ export class StartWithAsyncIterable extends AsyncIterableX { /** * Prepend a value to an async-iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @param {...TSource[]} args Elements to prepend to the specified sequence. * @returns {MonoTypeOperatorAsyncFunction} The source sequence prepended with the specified values. diff --git a/src/asynciterable/operators/take.ts b/src/asynciterable/operators/take.ts index ba053f90..8627802a 100644 --- a/src/asynciterable/operators/take.ts +++ b/src/asynciterable/operators/take.ts @@ -30,7 +30,6 @@ export class TakeAsyncIterable extends AsyncIterableX { /** * Returns a specified number of contiguous elements from the start of an async-iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} count The number of elements to return. * @returns {MonoTypeOperatorAsyncFunction} An async-iterable sequence that contains the specified diff --git a/src/asynciterable/operators/takelast.ts b/src/asynciterable/operators/takelast.ts index 90ab38c3..aaa3e8b6 100644 --- a/src/asynciterable/operators/takelast.ts +++ b/src/asynciterable/operators/takelast.ts @@ -34,7 +34,6 @@ export class TakeLastAsyncIterable extends AsyncIterableX { /** * Returns a specified number of contiguous elements from the end of an async-iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} count Number of elements to take from the end of the source sequence. * @returns {MonoTypeOperatorAsyncFunction} An async-iterable sequence containing the specified diff --git a/src/asynciterable/operators/takeuntil.ts b/src/asynciterable/operators/takeuntil.ts index 70a33a2c..000ecf2c 100644 --- a/src/asynciterable/operators/takeuntil.ts +++ b/src/asynciterable/operators/takeuntil.ts @@ -35,7 +35,6 @@ export class TakeUntilAsyncIterable extends AsyncIterableX { * Returns the elements from the source async-iterable sequence until the other function * that returns a promise produces an element. * - * @export * @template TSource The type of the elements in the source sequence. * @param {(signal?: AbortSignal) => Promise} other A function that terminates the propagation of * elements in the source sequence. diff --git a/src/asynciterable/operators/takewhile.ts b/src/asynciterable/operators/takewhile.ts index 88cf264b..89dd158d 100644 --- a/src/asynciterable/operators/takewhile.ts +++ b/src/asynciterable/operators/takewhile.ts @@ -35,7 +35,6 @@ export class TakeWhileAsyncIterable extends AsyncIterableX { /** * Returns elements from an async-iterable sequence as long as a specified condition is true. * - * @export * @template T The type of the elements in the source sequence. * @template S The result of the predicate that is truthy/falsy. * @param {(value: T, index: number, signal?: AbortSignal) => value is S} predicate A function to test each element for a condition. @@ -48,7 +47,6 @@ export function takeWhile( /** * Returns elements from an async-iterable sequence as long as a specified condition is true. * - * @export * @template T The type of the elements in the source sequence. * @param {((value: T, index: number, signal?: AbortSignal) => boolean | Promise)} predicate A function to test each element for a condition. * @returns {OperatorAsyncFunction} An async-iterable sequence that contains the elements from the input sequence that occur @@ -60,7 +58,6 @@ export function takeWhile( /** * Returns elements from an async-iterable sequence as long as a specified condition is true. * - * @export * @template T The type of the elements in the source sequence. * @param {((value: T, index: number, signal?: AbortSignal) => boolean | Promise)} predicate A function to test each element for a condition. * @returns {OperatorAsyncFunction} An async-iterable sequence that contains the elements from the input sequence that occur diff --git a/src/asynciterable/operators/tap.ts b/src/asynciterable/operators/tap.ts index fd09a866..3de16a70 100644 --- a/src/asynciterable/operators/tap.ts +++ b/src/asynciterable/operators/tap.ts @@ -54,7 +54,6 @@ export class TapAsyncIterable extends AsyncIterableX { * messages through the result sequence. This method can be used for debugging, logging, etc. by * intercepting the message stream to run arbitrary actions for messages on the pipeline. * - * @export * @template TSource The type of the elements in the source sequence. * @param {PartialAsyncObserver} observer Observer whose methods to invoke as part of the source sequence's observation. * @returns {MonoTypeOperatorAsyncFunction} The source sequence with the side-effecting behavior applied. @@ -68,7 +67,6 @@ export function tap( * messages through the result sequence. This method can be used for debugging, logging, etc. by * intercepting the message stream to run arbitrary actions for messages on the pipeline. * - * @export * @template TSource The type of the elements in the source sequence. * @param {(((value: TSource) => any) | null)} [next] Function to invoke for each element in the async-iterable sequence. * @param {(((err: any) => any) | null)} [error] Function to invoke upon exceptional termination of the async-iterable sequence. @@ -86,7 +84,6 @@ export function tap( * messages through the result sequence. This method can be used for debugging, logging, etc. by * intercepting the message stream to run arbitrary actions for messages on the pipeline. * - * @export * @template TSource The type of the elements in the source sequence. * @param {(PartialAsyncObserver | ((value: TSource) => any) | null)} [observerOrNext] Observer whose methods to invoke as * part of the source sequence's observation or a function to invoke for each element in the async-iterable sequence. diff --git a/src/asynciterable/operators/throttle.ts b/src/asynciterable/operators/throttle.ts index 350a26ed..9754eadc 100644 --- a/src/asynciterable/operators/throttle.ts +++ b/src/asynciterable/operators/throttle.ts @@ -30,7 +30,6 @@ export class ThrottleAsyncIterable extends AsyncIterableX { /** * Throttles the source async-iterable sequence so that it doesn't emit more than one value during the given timeframe. * - * @export * @template TSource The type of elements in the source sequence. * @param {number} time The time in milliseconds to throttle the source sequence. * @returns {MonoTypeOperatorAsyncFunction} The source sequence throttled by the given timeframe. diff --git a/src/asynciterable/operators/timeinterval.ts b/src/asynciterable/operators/timeinterval.ts index a0977dca..ebf2adea 100644 --- a/src/asynciterable/operators/timeinterval.ts +++ b/src/asynciterable/operators/timeinterval.ts @@ -31,7 +31,6 @@ export class TimeIntervalAsyncIterable extends AsyncIterableX>} An async-iterable sequence with time * interval information on elements. diff --git a/src/asynciterable/operators/timeout.ts b/src/asynciterable/operators/timeout.ts index 9d42bee3..53dc34bc 100644 --- a/src/asynciterable/operators/timeout.ts +++ b/src/asynciterable/operators/timeout.ts @@ -7,7 +7,7 @@ import { isObject } from '../../util/isiterable'; import { safeRace } from '../../util/safeRace'; export class TimeoutError extends Error { - constructor(message: string = 'Timeout has occurred') { + constructor(message = 'Timeout has occurred') { super(message); Object.setPrototypeOf(this, TimeoutError.prototype); Error.captureStackTrace(this, this.constructor); @@ -77,7 +77,6 @@ export class TimeoutAsyncIterable extends AsyncIterableX { * Applies a timeout policy for each element in the async-iterable sequence. * If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutError is thrown. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} dueTime Maximum duration in milliseconds between values before a timeout occurs. * @returns {MonoTypeOperatorAsyncFunction} The source sequence with a TimeoutError in case of a timeout. diff --git a/src/asynciterable/operators/timestamp.ts b/src/asynciterable/operators/timestamp.ts index 7de94d65..b1c1c3ca 100644 --- a/src/asynciterable/operators/timestamp.ts +++ b/src/asynciterable/operators/timestamp.ts @@ -27,7 +27,6 @@ export class TimestampAsyncIterable extends AsyncIterableX>} An async-iterable sequence with timestamp information on elements. */ diff --git a/src/asynciterable/operators/union.ts b/src/asynciterable/operators/union.ts index 040ac7e8..0ff87d23 100644 --- a/src/asynciterable/operators/union.ts +++ b/src/asynciterable/operators/union.ts @@ -43,7 +43,6 @@ export class UnionAsyncIterable extends AsyncIterableX { /** * Produces the set union of two sequences by using the given equality comparer. * - * @export * @template TSource The type of the elements of the input sequences. * @param {AsyncIterable} right An async-iterable sequence whose distinct elements form the second set for the union. * @param {((x: TSource, y: TSource) => boolean | Promise)} [comparer=comparerAsync] The equality comparer to compare values. diff --git a/src/asynciterable/operators/withabort.ts b/src/asynciterable/operators/withabort.ts index ea62af28..7eec37b6 100644 --- a/src/asynciterable/operators/withabort.ts +++ b/src/asynciterable/operators/withabort.ts @@ -23,7 +23,6 @@ export class WithAbortAsyncIterable extends AsyncIterableX { /** * Wraps the existing async-iterable sequence with an abort signal for cancellation. * - * @export * @template TSource The type of the elements in the source sequence. * @param {AbortSignal} signal The abort signal used for cancellation. * @returns {MonoTypeOperatorAsyncFunction} An async-iterable that can be cancelled by the abort signal. @@ -39,7 +38,6 @@ export function withAbort(signal: AbortSignal): MonoTypeOperatorAsyncFu /** * Wraps an existing async-iterable with a new async-iterable which support cancellation. * - * @export * @template TSource The type of the elements in the source sequence. * @param {AsyncIterable} source The source sequence to wrap with the abort signal. * @param {AbortSignal} [signal] The abort signal used for cancellation. diff --git a/src/asynciterable/operators/withlatestfrom.ts b/src/asynciterable/operators/withlatestfrom.ts index bff3d06c..f4eb4f04 100644 --- a/src/asynciterable/operators/withlatestfrom.ts +++ b/src/asynciterable/operators/withlatestfrom.ts @@ -83,7 +83,6 @@ export class WithLatestFromAsyncIterable extends AsyncIterableX} source2 Second async-iterable source. @@ -97,7 +96,6 @@ export function withLatestFrom( * Merges multiple async-iterable sequences into one async-iterable sequence by combining each element * from the first source with the latest element from the other sources, if any. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -114,7 +112,6 @@ export function withLatestFrom( * Merges multiple async-iterable sequences into one async-iterable sequence by combining each element * from the first source with the latest element from the other sources, if any. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -134,7 +131,6 @@ export function withLatestFrom( * Merges multiple async-iterable sequences into one async-iterable sequence by combining each element * from the first source with the latest element from the other sources, if any. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -157,7 +153,6 @@ export function withLatestFrom( * Merges multiple async-iterable sequences into one async-iterable sequence by combining each element * from the first source with the latest element from the other sources, if any. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -184,7 +179,6 @@ export function withLatestFrom( * Merges multiple async-iterable sequences into one async-iterable sequence by combining each element * from the first source with the latest element from the other sources, if any. * - * @export * @template T The type of the elements in the source sequences. * @param {...AsyncIterable[]} sources The source sequences. * @returns {OperatorAsyncFunction} An async-iterable sequence containing the result of combining diff --git a/src/asynciterable/operators/zipwith.ts b/src/asynciterable/operators/zipwith.ts index 7ac820cb..f9a93ccb 100644 --- a/src/asynciterable/operators/zipwith.ts +++ b/src/asynciterable/operators/zipwith.ts @@ -4,7 +4,6 @@ import { ZipAsyncIterable } from '../zip'; /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @param {AsyncIterable} source2 The second async-iterable source. @@ -14,7 +13,6 @@ export function zipWith(source2: AsyncIterable): OperatorAsyncFunctio /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -29,7 +27,6 @@ export function zipWith( /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -47,7 +44,6 @@ export function zipWith( /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -69,7 +65,6 @@ export function zipWith( /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -95,7 +90,6 @@ export function zipWith( /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of elements in the source sequences. * @param {...AsyncIterable[]} sources The source sequences. * @returns {AsyncIterableX} Async iterable with an array of each element from the source sequences in a pairwise fashion. diff --git a/src/asynciterable/race.ts b/src/asynciterable/race.ts index 4bf3927c..108ea917 100644 --- a/src/asynciterable/race.ts +++ b/src/asynciterable/race.ts @@ -62,7 +62,6 @@ export class RaceAsyncIterable extends AsyncIterableX { /** * Propagates the async sequence that reacts first. * - * @export * @param {...AsyncIterable[]} sources The source sequences. * @return {AsyncIterable} An async sequence that surfaces either of the given sequences, whichever reacted first. */ diff --git a/src/asynciterable/range.ts b/src/asynciterable/range.ts index dd6582bc..9d5717cf 100644 --- a/src/asynciterable/range.ts +++ b/src/asynciterable/range.ts @@ -22,7 +22,6 @@ class RangeAsyncIterable extends AsyncIterableX { /** * Generates an async-iterable sequence of integral numbers within a specified range. * - * @export * @param {number} start The value of the first integer in the sequence. * @param {number} count The number of sequential integers to generate. * @returns {AsyncIterableX} An async-iterable sequence that contains a range of sequential integral numbers. diff --git a/src/asynciterable/reduce.ts b/src/asynciterable/reduce.ts index 3cd4975d..80a27bba 100644 --- a/src/asynciterable/reduce.ts +++ b/src/asynciterable/reduce.ts @@ -7,7 +7,6 @@ import { throwIfAborted } from '../aborterror'; * single element in the result sequence. The seed value, if specified, is used as the initial accumulator value. * For aggregation behavior with incremental intermediate results, scan. * - * @export * @template T The type of the elements in the source sequence. * @template R The type of the result of the aggregation. * @param {AsyncIterable} source An async-iterable sequence to aggregate over. diff --git a/src/asynciterable/reduceoptions.ts b/src/asynciterable/reduceoptions.ts index ee1c0e0f..8a75f0c3 100644 --- a/src/asynciterable/reduceoptions.ts +++ b/src/asynciterable/reduceoptions.ts @@ -3,7 +3,6 @@ import { ScanOptions } from './operators/scanoptions'; /** * The reduce options which includes an accumulator function, optional seed, and optional abort signal for cancellation. * - * @export * @interface ReduceOptions * @extends {ScanOptions} * @template T The type of the elements in the source sequence. diff --git a/src/asynciterable/reduceright.ts b/src/asynciterable/reduceright.ts index 6d73fcac..e2e5a978 100644 --- a/src/asynciterable/reduceright.ts +++ b/src/asynciterable/reduceright.ts @@ -7,7 +7,6 @@ import { throwIfAborted } from '../aborterror'; * single element in the result sequence. The seed value, if specified, is used as the initial accumulator value. * For aggregation behavior with incremental intermediate results, scan. * - * @export * @template T The type of the elements in the source sequence. * @template R The type of the result of the aggregation. * @param {AsyncIterable} source An async-iterable sequence to aggregate over from the right. diff --git a/src/asynciterable/repeatvalue.ts b/src/asynciterable/repeatvalue.ts index 1123be77..bc34774a 100644 --- a/src/asynciterable/repeatvalue.ts +++ b/src/asynciterable/repeatvalue.ts @@ -29,12 +29,11 @@ export class RepeatValueAsyncIterable extends AsyncIterableX { /** * Repeats a given value for the specified number of times as an async-iterable. * - * @export * @template TSource The type of element to repeat. * @param {TSource} value The value to repeat as an async-iterable. * @param {number} [count=-1] The number of times to repeat the value, infinite if not specified. * @returns {AsyncIterableX} An async-iterable with a single item that is repeated over the specified times. */ -export function repeatValue(value: TSource, count: number = -1): AsyncIterableX { +export function repeatValue(value: TSource, count = -1): AsyncIterableX { return new RepeatValueAsyncIterable(value, count); } diff --git a/src/asynciterable/sequenceequal.ts b/src/asynciterable/sequenceequal.ts index 41610aaf..a664fc64 100644 --- a/src/asynciterable/sequenceequal.ts +++ b/src/asynciterable/sequenceequal.ts @@ -27,7 +27,6 @@ export interface SequencEqualOptions { /** * Determines whether two sequences are equal by comparing the elements pairwise. * - * @export * @template T The type of the elements in the source sequence. * @param {AsyncIterable} source First async-iterable sequence to compare. * @param {AsyncIterable} other Second async-iterable sequence to compare. diff --git a/src/asynciterable/single.ts b/src/asynciterable/single.ts index 754b93da..3712a5dc 100644 --- a/src/asynciterable/single.ts +++ b/src/asynciterable/single.ts @@ -7,7 +7,6 @@ import { OptionalFindOptions } from './findoptions'; * or undefined if no such element exists; this method reports an exception if there is more * than one element in the async-iterable sequence. * - * @export * @template T The type of the elements in the source sequence. * @param {AsyncIterable} source Source async-iterable sequence. * @param {OptionalFindOptions} [options] The optional options which includes a predicate for filtering, diff --git a/src/asynciterable/some.ts b/src/asynciterable/some.ts index 7e955c1e..96217a01 100644 --- a/src/asynciterable/some.ts +++ b/src/asynciterable/some.ts @@ -5,7 +5,6 @@ import { FindOptions } from './findoptions'; /** * Determines whether any element of an async-iterable sequence satisfies a condition. * - * @export * @template T The type of the elements in the source sequence. * @param {AsyncIterable} source An async-iterable sequence whose elements to apply the predicate to. * @param {FindOptions} options The options which includes a required predicate, an optional diff --git a/src/asynciterable/sum.ts b/src/asynciterable/sum.ts index 800388ff..a9758605 100644 --- a/src/asynciterable/sum.ts +++ b/src/asynciterable/sum.ts @@ -6,7 +6,6 @@ import { MathOptions } from './mathoptions'; /** * Computes the sum of a sequence of values. * - * @export * @param {AsyncIterable} source A sequence of values to calculate the sum. * @param {MathOptions} [options] Optional options for providing a selector, thisArg and abort signal. * @returns {Promise} A promise containing the sum of the sequence of values. @@ -18,7 +17,6 @@ export async function sum( /** * Computes the sum of a sequence of values. * - * @export * @template T The type of values in the source sequence. * @param {AsyncIterable} source A sequence of values to calculate the sum. * @param {MathOptions} [options] Optional options for providing a selector, thisArg and abort signal. @@ -28,7 +26,6 @@ export async function sum(source: AsyncIterable, options?: MathOptions) /** * Computes the sum of a sequence of values. * - * @export * @param {AsyncIterable} source A sequence of values to calculate the sum. * @param {MathOptions} [options] Optional options for providing a selector, thisArg and abort signal. * @returns {Promise} A promise containing the sum of the sequence of values. diff --git a/src/asynciterable/throwerrror.ts b/src/asynciterable/throwerrror.ts index 182a26d0..045efe29 100644 --- a/src/asynciterable/throwerrror.ts +++ b/src/asynciterable/throwerrror.ts @@ -18,7 +18,6 @@ class ThrowAsyncIterable extends AsyncIterableX { /** * Creates an async-iterable that throws the specified error upon iterating. * - * @export * @param {*} error The error to throw upon iterating the async-iterable. * @returns {AsyncIterableX} An async-iterable that throws when iterated. */ diff --git a/src/asynciterable/toarray.ts b/src/asynciterable/toarray.ts index f8ca154c..a4544096 100644 --- a/src/asynciterable/toarray.ts +++ b/src/asynciterable/toarray.ts @@ -4,7 +4,6 @@ import { throwIfAborted } from '../aborterror'; /** * Converts an existing async-iterable to a promise containing the array of values. * - * @export * @template TSource The type of elements in the source sequence. * @param {AsyncIterable} source The source sequence to convert to an array. * @param {AbortSignal} [signal] An optional abort signal to cancel the operation at any time. diff --git a/src/asynciterable/todomstream.ts b/src/asynciterable/todomstream.ts index bf13ab0a..aeb8e475 100644 --- a/src/asynciterable/todomstream.ts +++ b/src/asynciterable/todomstream.ts @@ -9,9 +9,9 @@ export type ReadableByteStreamOptions = QueuingStrategy & { }; type AsyncSourceIterator = AsyncIterator< -TSource, -any, -number | ArrayBufferView | undefined | null + TSource, + any, + number | ArrayBufferView | undefined | null >; /** @ignore */ @@ -63,8 +63,8 @@ class UnderlyingAsyncIterableDefaultSource extends AbstractUnderl class UnderlyingAsyncIterableByteSource extends AbstractUnderlyingSource - implements UnderlyingByteSource { - public readonly type: 'bytes'; + implements UnderlyingSource { + // public readonly type: 'bytes'; public readonly autoAllocateChunkSize?: number; // If we can't create a "byob" reader (no browsers currently suppor it), @@ -77,33 +77,33 @@ class UnderlyingAsyncIterableByteSource(reader); } // eslint-disable-next-line consistent-return - async pull(controller: ReadableByteStreamController) { - if (!controller.byobRequest) { + async pull(controller: ReadableStreamController) { + if (!(controller as any).byobRequest) { return await this.fallbackDefaultSource.pull(controller); } if (this._source) { - const { view } = controller.byobRequest; + const { view } = (controller as any).byobRequest; const { done, value } = await this._source.next(view); if (!done) { // Did the source write into the BYOB view itself, // then yield us the `bytesWritten` value? If so, // pass that along if (typeof value === 'number') { - return controller.byobRequest.respond(value); + return (controller as any).byobRequest.respond(value); } // otherwise if the source is only producing buffers // but doesn't expect to be given one, we should copy // the produced buffer into the front of the BYOB view if (ArrayBuffer.isView(value)) { return value.buffer === view.buffer - ? controller.byobRequest.respondWithNewView(value) - : controller.byobRequest.respond(memcpy(view, value)); + ? (controller as any).byobRequest.respondWithNewView(value) + : (controller as any).byobRequest.respond(memcpy(view, value)); } } } @@ -203,27 +203,30 @@ export function toDOMStream( ); } return asyncIterableReadableStream( - new UnderlyingAsyncIterableByteSource(source[Symbol.asyncIterator]()), + new UnderlyingAsyncIterableByteSource( + source[Symbol.asyncIterator](), + options as ReadableByteStreamOptions + ), options ); } -AsyncIterableX.prototype.tee = function (this: AsyncIterableX) { +AsyncIterableX.prototype.tee = function (this: AsyncIterableX) { return _getDOMStream(this).tee(); }; -AsyncIterableX.prototype.pipeTo = function ( +AsyncIterableX.prototype.pipeTo = function ( this: AsyncIterableX, writable: WritableStream, - options?: PipeOptions + options?: StreamPipeOptions ) { return _getDOMStream(this).pipeTo(writable, options); }; -AsyncIterableX.prototype.pipeThrough = function > ( +AsyncIterableX.prototype.pipeThrough = function >( this: AsyncIterableX, duplex: { writable: WritableStream; readable: R }, - options?: PipeOptions + options?: StreamPipeOptions ) { return _getDOMStream(this).pipeThrough(duplex, options); }; @@ -260,10 +263,10 @@ declare module '../asynciterable/asynciterablex' { interface AsyncIterableX { toDOMStream: typeof toDOMStreamProto; tee(): [ReadableStream, ReadableStream]; - pipeTo(writable: WritableStream, options?: PipeOptions): Promise; + pipeTo(writable: WritableStream, options?: StreamPipeOptions): Promise; pipeThrough>( duplex: { writable: WritableStream; readable: R }, - options?: PipeOptions + options?: StreamPipeOptions ): ReadableStream; } } diff --git a/src/asynciterable/tomap.ts b/src/asynciterable/tomap.ts index e60ed927..a65a71e7 100644 --- a/src/asynciterable/tomap.ts +++ b/src/asynciterable/tomap.ts @@ -34,7 +34,6 @@ export interface ToMapOptions { /** * Converts an async-iterable to a map with a key selector and options for an element selector and cancellation. * - * @export * @template TSource The type of elements in the source collection. * @template TKey The type of key used for the map. * @template TElement The type of element to use for the map. diff --git a/src/asynciterable/tonodestream.ts b/src/asynciterable/tonodestream.ts index 8f72e49d..4b92c03f 100644 --- a/src/asynciterable/tonodestream.ts +++ b/src/asynciterable/tonodestream.ts @@ -5,14 +5,14 @@ import { Readable, ReadableOptions } from 'stream'; const done = async (_: any) => null as any; type AsyncSourceIterator = AsyncIterator< -TSource, -any, -number | ArrayBufferView | undefined | null + TSource, + any, + number | ArrayBufferView | undefined | null >; export class AsyncIterableReadable extends Readable { - private _pulling: boolean = false; - private _objectMode: boolean = true; + private _pulling = false; + private _objectMode = true; private _iterator: AsyncSourceIterator | undefined; constructor(source: AsyncIterable, options?: ReadableOptions) { super(options); diff --git a/src/asynciterable/toobservable.ts b/src/asynciterable/toobservable.ts index 5c4bb537..2a6a9aaa 100644 --- a/src/asynciterable/toobservable.ts +++ b/src/asynciterable/toobservable.ts @@ -4,7 +4,7 @@ import { Observable, PartialObserver } from '../observer'; import { Subscription } from '../subscription'; class BooleanSubscription implements Subscription { - public isUnsubscribed: boolean = false; + public isUnsubscribed = false; unsubscribe() { this.isUnsubscribed = true; @@ -57,7 +57,6 @@ class AsyncIterableObservable implements Observable { /** * Converts the async-iterable sequence to an observable. * - * @export * @template TSource The type of the elements in the source sequence. * @param {AsyncIterable} source The async-iterable to convert to an observable. * @returns {Observable} The observable containing the elements from the async-iterable. diff --git a/src/asynciterable/toset.ts b/src/asynciterable/toset.ts index 1fbf8eec..b51fb987 100644 --- a/src/asynciterable/toset.ts +++ b/src/asynciterable/toset.ts @@ -4,7 +4,6 @@ import { throwIfAborted } from '../aborterror'; /** * Converts the existing async-iterable into a promise which resolves a Set. * - * @export * @template TSource The type of elements in the source sequence. * @param {AsyncIterable} source The async-iterable to convert into a set. * @param {AbortSignal} [signal] An optional abort signal to cancel the operation at any time. diff --git a/src/asynciterable/whiledo.ts b/src/asynciterable/whiledo.ts index 2c72d176..795b7ad4 100644 --- a/src/asynciterable/whiledo.ts +++ b/src/asynciterable/whiledo.ts @@ -29,7 +29,6 @@ class WhileAsyncIterable extends AsyncIterableX { * Repeats the given source as long as the specified conditions holds, where * the condition is evaluated before each repeated source is iterated. * - * @export * @template TSource * @param {AsyncIterable} source Source to repeat as long as the condition function evaluates to true. * @param {((signal?: AbortSignal) => boolean | Promise)} condition Condition that will be evaluated before the source sequence is iterated. diff --git a/src/asynciterable/zip.ts b/src/asynciterable/zip.ts index 818ff31d..cbbdf690 100644 --- a/src/asynciterable/zip.ts +++ b/src/asynciterable/zip.ts @@ -34,7 +34,6 @@ export class ZipAsyncIterable extends AsyncIterableX { /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @param {AsyncIterable} source The first async-iterable source. @@ -48,7 +47,6 @@ export function zip( /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -65,7 +63,6 @@ export function zip( /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -85,7 +82,6 @@ export function zip( /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -108,7 +104,6 @@ export function zip( /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -135,7 +130,6 @@ export function zip( /** * Merges multiple async-iterable sequences into one async-iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of elements in the source sequences. * @param {...AsyncIterable[]} sources The source sequences. * @returns {AsyncIterableX} Async iterable with an array of each element from the source sequences in a pairwise fashion. diff --git a/src/iterable/as.ts b/src/iterable/as.ts index 9a1956a9..081d1cf8 100644 --- a/src/iterable/as.ts +++ b/src/iterable/as.ts @@ -6,7 +6,6 @@ import { identity } from '../util/identity'; /** * Converts an existing string into an iterable of characters. * - * @export * @param {string} source The string to convert to an iterable. * @returns {IterableX} An terable stream of characters from the source. */ @@ -14,7 +13,6 @@ export function as(source: string): IterableX; /** * Converts the iterable like input into an iterable. * - * @export * @template T The tyep of elements in the source iterable. * @param {Iterable} source The iterable to convert to an iterable. * @returns {IterableX} An iterable stream of the source sequence. @@ -23,7 +21,6 @@ export function as(source: Iterable): IterableX; /** * Converts an array-like object to an iterable. * - * @export * @template T The type of elements in the source array-like sequence. * @param {ArrayLike} source The array-like sequence to convert to an iterable. * @returns {IterableX} The iterable containing the elements from the array-like sequence. @@ -32,7 +29,6 @@ export function as(source: ArrayLike): IterableX; /** * Converts the object into a singleton in an iterable sequence. * - * @export * @template T The type of element to turn into an iterable sequence. * @param {T} source The item to turn into an iterable sequence. * @returns {IterableX} An iterable sequence from the source object. diff --git a/src/iterable/average.ts b/src/iterable/average.ts index 94108efd..93e0e4e5 100644 --- a/src/iterable/average.ts +++ b/src/iterable/average.ts @@ -4,7 +4,6 @@ import { MathOptions } from './mathoptions'; /** * Computes the average of the iterable sequence. * - * @export * @param {Iterable} source The source iterable sequence to compute the average. * @param {MathOptions} [options] The options for calculating the average. * @returns {number} The computed average for the iterable sequence. @@ -14,7 +13,6 @@ export function average(source: Iterable, options?: MathOptions) /** * Computes the average of the iterable sequence. * - * @export * @template T The type of elements in the source sequence. * @param {Iterable} source The source iterable sequence to compute the average. * @param {MathOptions} [options] The options for calculating the average. @@ -25,7 +23,6 @@ export function average(source: Iterable, options?: MathOptions): numbe /** * Computes the average of the iterable sequence. * - * @export * @param {Iterable} source The source iterable sequence to compute the average. * @param {MathOptions} [options] The options for calculating the average. * @returns {number} The computed average for the iterable sequence. diff --git a/src/iterable/concat.ts b/src/iterable/concat.ts index 4b1aff09..3fdb5714 100644 --- a/src/iterable/concat.ts +++ b/src/iterable/concat.ts @@ -19,7 +19,6 @@ export function concat(v1: Iterable): IterableX; /** * Concatenates the second iterable sequence to the first iterable sequence upon successful termination of the first. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @param {Iterable} v1 First iterable source. @@ -32,7 +31,6 @@ export function concat(v1: Iterable, v2: Iterable): IterableX( * Concatenates all iterable sequences in the given sequences, as long as the previous iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -71,7 +68,6 @@ export function concat( * Concatenates all iterable sequences in the given sequences, as long as the previous iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -95,7 +91,6 @@ export function concat( * Concatenates all iterable sequences in the given sequences, as long as the previous iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -123,7 +118,6 @@ export function concat( * Concatenates all iterable sequences in the given sequences, as long as the previous iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the sequences. * @param {...Iterable[]} args The iterable sources. * @returns {IterableX} An iterable sequence that contains the elements of each given sequence, in sequential order. diff --git a/src/iterable/count.ts b/src/iterable/count.ts index 59f927e0..ee2b0cc7 100644 --- a/src/iterable/count.ts +++ b/src/iterable/count.ts @@ -4,7 +4,6 @@ import { OptionalFindOptions } from './findoptions'; * Returns a promise that represents how many elements in the specified iterable sequence satisfy a condition * otherwise, the number of items in the sequence. * - * @export * @template T The type of elements in the source collection. * @param {Iterable} source An iterable sequence that contains elements to be counted. * @param {OptionalFindOptions} [options] The options for a predicate for filtering and thisArg for binding. diff --git a/src/iterable/create.ts b/src/iterable/create.ts index daf9fcc2..fca47f69 100644 --- a/src/iterable/create.ts +++ b/src/iterable/create.ts @@ -16,7 +16,6 @@ class AnonymousIterable extends IterableX { /** * Creates a new iterable using the specified function implementing the members of AsyncIterable * - * @export * @template T The type of the elements returned by the iterable sequence. * @param {(() => Iterator)} fn The function that creates the [Symbol.iterator]() method * @returns {IterableX} A new iterable instance. diff --git a/src/iterable/defer.ts b/src/iterable/defer.ts index 87531859..e5b74cfd 100644 --- a/src/iterable/defer.ts +++ b/src/iterable/defer.ts @@ -18,7 +18,6 @@ class DeferIterable extends IterableX { /** * Returns an iterable sequence that invokes the specified factory function whenever a call to [Symbol.iterator] has been made. * - * @export * @template TSource The type of the elements in the sequence returned by the factory function, and in the resulting sequence. * @param {(() => Iterable)} factory iterable factory function to invoke for each call to [Symbol.iterator]. * @returns {AsyncIterableX} An iterable sequence whose observers trigger an invocation of the given iterable factory function. diff --git a/src/iterable/elementat.ts b/src/iterable/elementat.ts index 9690b522..b61d4294 100644 --- a/src/iterable/elementat.ts +++ b/src/iterable/elementat.ts @@ -1,7 +1,6 @@ /** * Returns the element at a specified index in a sequence or undefined if the index is out of range. * - * @export * @template T The type of the elements in the source sequence. * @param {Iterable} source iterable sequence to return the element from. * @param {number} index The zero-based index of the element to retrieve. diff --git a/src/iterable/empty.ts b/src/iterable/empty.ts index 94661d5c..f51b2ce9 100644 --- a/src/iterable/empty.ts +++ b/src/iterable/empty.ts @@ -9,7 +9,6 @@ class EmptyIterable extends IterableX { /** * Returns an empty iterable sequence. * - * @export * @template TSource The type used for the iterable type parameter of the resulting sequence. * @returns {IterableX} An iterable sequence with no elements. */ diff --git a/src/iterable/every.ts b/src/iterable/every.ts index 7d6167f0..117d2809 100644 --- a/src/iterable/every.ts +++ b/src/iterable/every.ts @@ -3,7 +3,6 @@ import { FindOptions } from './findoptions'; /** * Determines whether all elements of an iterable sequence satisfy a condition. * - * @export * @template T The type of the elements in the source sequence. * @param {Iterable} source An iterable sequence whose elements to apply the predicate to. * @param {FindOptions} options The options for a predicate for filtering, thisArg for binding and AbortSignal for cancellation. diff --git a/src/iterable/find.ts b/src/iterable/find.ts index 03706c6d..56c5291e 100644 --- a/src/iterable/find.ts +++ b/src/iterable/find.ts @@ -3,7 +3,6 @@ import { FindOptions } from './findoptions'; /** * Returns the value of the first element in the provided iterable that satisfies the provided testing function. * - * @export * @template T The type of the elements in the source sequence. * @param {Iterable} source An iterable sequence whose elements to apply the predicate to. * @param {FindOptions} options The options for a predicate for filtering, thisArg for binding and AbortSignal for cancellation. diff --git a/src/iterable/findindex.ts b/src/iterable/findindex.ts index fc252263..51bfbfcc 100644 --- a/src/iterable/findindex.ts +++ b/src/iterable/findindex.ts @@ -4,7 +4,6 @@ import { FindOptions } from './findoptions'; * Returns the index of the first element in the array that satisfies the provided testing function. * Otherwise, it returns -1, indicating that no element passed the test. * - * @export * @template T The type of the elements in the source sequence. * @param {Iterable} source An iterable sequence whose elements to apply the predicate to. * @param {FindOptions} options The options for a predicate for filtering, thisArg for binding and AbortSignal for cancellation. diff --git a/src/iterable/findoptions.ts b/src/iterable/findoptions.ts index f7403f1f..63ace7c2 100644 --- a/src/iterable/findoptions.ts +++ b/src/iterable/findoptions.ts @@ -1,7 +1,6 @@ /** * A find options property bag with the selector and thisArg for binding all optional. * - * @export * @interface OptionalFindOptions * @template T The type of the elements in the source sequence. */ @@ -25,7 +24,6 @@ export interface OptionalFindOptions { /** * A find options property bag with the selector being required and the thisArg for binding are all optional. * - * @export * @interface FindOptions * @template T The type of the elements in the source sequence. */ diff --git a/src/iterable/first.ts b/src/iterable/first.ts index 8a42eaef..5fe57832 100644 --- a/src/iterable/first.ts +++ b/src/iterable/first.ts @@ -3,7 +3,6 @@ import { OptionalFindOptions } from './findoptions'; /** * Returns the first element of an iterable sequence that matches the predicate if provided, or undefined if no such element exists. * - * @export * @template T The type of the elements in the source sequence. * @param {Iterable} source Source async-enumerable sequence. * @returns {(S | undefined)} The first element in the iterable sequence, or undefined if no such element exists. diff --git a/src/iterable/generate.ts b/src/iterable/generate.ts index fc32f27a..ea65bb61 100644 --- a/src/iterable/generate.ts +++ b/src/iterable/generate.ts @@ -29,7 +29,6 @@ class GenerateIterable extends IterableX { /** * Generates an iterable sequence by running a state-driven loop producing the sequence's elements. * - * @export * @template TState The type of the state used in the generator loop. * @template TResult The type of the elements in the produced sequence. * @param {TState} initialState The initial state. diff --git a/src/iterable/iif.ts b/src/iterable/iif.ts index 294496ce..ca1c3efe 100644 --- a/src/iterable/iif.ts +++ b/src/iterable/iif.ts @@ -6,7 +6,6 @@ import { empty } from './empty'; * If the specified condition evaluates true, select the thenSource sequence. * Otherwise, select the elseSource sequence. * - * @export * @template TSource The type of the elements in the result sequence. * @param {(() => boolean)} condition Condition evaluated to decide which sequence to return. * @param {Iterable} thenSource Sequence returned in case evaluates true. diff --git a/src/iterable/includes.ts b/src/iterable/includes.ts index b0f8672d..1f0a32ba 100644 --- a/src/iterable/includes.ts +++ b/src/iterable/includes.ts @@ -3,14 +3,13 @@ import { comparer } from '../util/comparer'; /** * Determines whether an itreable includes a certain value among its entries, returning true or false as appropriate. * - * @export * @template T The type of elements in the source sequence. * @param {Iterable} source The source sequence to search for the item. * @param {T} valueToFind The value to search for. * @param {number} [fromIndex=0] The position in this iterable at which to begin searching for valueToFind. * @returns {boolean} Returns true if the value valueToFind is found within the iterable. */ -export function includes(source: Iterable, searchElement: T, fromIndex: number = 0): boolean { +export function includes(source: Iterable, searchElement: T, fromIndex = 0): boolean { let fromIdx = fromIndex; let i = 0; if (Math.abs(fromIdx)) { diff --git a/src/iterable/isempty.ts b/src/iterable/isempty.ts index 9109c2b8..97e3b3a9 100644 --- a/src/iterable/isempty.ts +++ b/src/iterable/isempty.ts @@ -1,7 +1,6 @@ /** * Determines whether the given async-iterable is empty. * - * @export * @template T The type of elements in the source sequence. * @param {Iterable} source The source async-iterable to determine whether it is empty. * @returns {boolean} Returns true if the sequence is empty, otherwise false. diff --git a/src/iterable/last.ts b/src/iterable/last.ts index 7caac3a3..e0866b35 100644 --- a/src/iterable/last.ts +++ b/src/iterable/last.ts @@ -4,7 +4,6 @@ import { OptionalFindOptions } from './findoptions'; * Returns the last element of an iterable sequence that satisfies the condition in the predicate if given * otherwise the last item in the sequence, or a default value if no such element exists. * - * @export * @template T The type of elements in the source sequence. * @param {Iterable} source The source iterable sequence. * @param {OptionalFindSubclassedOptions} [options] The options which include an optional predicate for filtering, diff --git a/src/iterable/mathoptions.ts b/src/iterable/mathoptions.ts index 19d7dbf4..174f71e3 100644 --- a/src/iterable/mathoptions.ts +++ b/src/iterable/mathoptions.ts @@ -1,7 +1,6 @@ /** * The options for calculating an average. * - * @export * @interface MathOptions * @template T The type of elements in the source sequence. */ diff --git a/src/iterable/max.ts b/src/iterable/max.ts index 453247f3..bdde19d3 100644 --- a/src/iterable/max.ts +++ b/src/iterable/max.ts @@ -5,7 +5,6 @@ import { ExtremaOptions } from './extremaoptions'; /** * Returns the maximum element with the optional selector. * - * @export * @template TSource The type of the elements in the source sequence. * @param {Iterable} source An async-iterable sequence to determine the maximum element of. * @param {ExtremaByOptions} [options] The options which include an optional comparer and abort signal. diff --git a/src/iterable/maxby.ts b/src/iterable/maxby.ts index c48057ad..d62bb24a 100644 --- a/src/iterable/maxby.ts +++ b/src/iterable/maxby.ts @@ -5,7 +5,6 @@ import { equalityComparer } from '../util/comparer'; /** * Returns the elements in an iterable sequence with the maximum key value. * - * @export * @template TSource The type of the elements in the source sequence. * @template TKey The type of the key computed for each element in the source sequence. * @param {Iterable} source The source to get the maximum by. diff --git a/src/iterable/min.ts b/src/iterable/min.ts index 7ce1a0f7..358f829e 100644 --- a/src/iterable/min.ts +++ b/src/iterable/min.ts @@ -5,7 +5,6 @@ import { ExtremaOptions } from './extremaoptions'; /** * * Returns the minimum element with the optional selector. * - * @export * @template TSource The type of the elements in the source sequence. * @param {Iterable} source An iterable sequence to determine the minimum element of. * @param {ExtremaByOptions} [options] The options which include an optional comparer. diff --git a/src/iterable/minby.ts b/src/iterable/minby.ts index d2b926ea..796367ee 100644 --- a/src/iterable/minby.ts +++ b/src/iterable/minby.ts @@ -5,7 +5,6 @@ import { equalityComparer } from '../util/comparer'; /** * Returns the elements in an terable sequence with the minimum key value. * - * @export * @template TSource The type of the elements in the source sequence. * @template TKey The type of the key computed for each element in the source sequence. * @param {Iterable} source An async-iterable sequence to get the minimum elements for. diff --git a/src/iterable/of.ts b/src/iterable/of.ts index cf6b8671..52c2e055 100644 --- a/src/iterable/of.ts +++ b/src/iterable/of.ts @@ -3,7 +3,6 @@ import { IterableX } from './iterablex'; /** * Creates an iterable from the specified elements. * - * @export * @template TSource The type of the elements to create an iterable sequence. * @param {...TSource[]} args The elements to turn into an iterable sequence. * @returns {IterableX} The iterable sequence created from the elements. diff --git a/src/iterable/onerrorresumenext.ts b/src/iterable/onerrorresumenext.ts index 185b088e..7a9be606 100644 --- a/src/iterable/onerrorresumenext.ts +++ b/src/iterable/onerrorresumenext.ts @@ -31,7 +31,6 @@ export class OnErrorResumeNextIterable extends IterableX { /** * Concatenates all of the specified iterable sequences, even if the previous iterable sequence terminated exceptionally. * - * @export * @template T The type of the elements in the source sequences. * @param {...Iterable[]} args iterable sequences to concatenate. * @returns {IterableX} An iterable sequence that concatenates the source sequences, even if a sequence terminates exceptionally. diff --git a/src/iterable/operators/_refcountlist.ts b/src/iterable/operators/_refcountlist.ts index 6fe231b1..8f501904 100644 --- a/src/iterable/operators/_refcountlist.ts +++ b/src/iterable/operators/_refcountlist.ts @@ -46,7 +46,7 @@ export class MaxRefCountList implements IRefCountList { export class RefCountList implements IRefCountList { private _readerCount: number; private _list: Map>; - private _count: number = 0; + private _count = 0; constructor(readerCount: number) { this._readerCount = readerCount; diff --git a/src/iterable/operators/catcherror.ts b/src/iterable/operators/catcherror.ts index be02dd35..ba4b35e6 100644 --- a/src/iterable/operators/catcherror.ts +++ b/src/iterable/operators/catcherror.ts @@ -48,7 +48,6 @@ export class CatchWithIterable extends IterableX Iterable} handler Error handler function, producing another async-iterable sequence. diff --git a/src/iterable/operators/concatall.ts b/src/iterable/operators/concatall.ts index 18227043..9197bf9b 100644 --- a/src/iterable/operators/concatall.ts +++ b/src/iterable/operators/concatall.ts @@ -6,7 +6,6 @@ import { OperatorFunction } from '../../interfaces'; * Concatenates all inner iterable sequences, as long as the previous * iterable sequence terminated successfully. * - * @export * @template T The type of elements in the source sequence. * @returns {OperatorFunction, T>} An operator which concatenates all inner iterable sources. */ diff --git a/src/iterable/operators/concatwith.ts b/src/iterable/operators/concatwith.ts index 585bccc1..d609df08 100644 --- a/src/iterable/operators/concatwith.ts +++ b/src/iterable/operators/concatwith.ts @@ -4,7 +4,6 @@ import { ConcatIterable } from '../concat'; /** * Concatenates the second iterable sequence to the first iterable sequence upon successful termination of the first. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @param {Iterable} v1 First iterable source. @@ -17,7 +16,6 @@ export function concatWith(v2: Iterable): OperatorFunction * Concatenates all iterable sequences in the given sequences, as long as the previous iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -35,7 +33,6 @@ export function concatWith( * Concatenates all iterable sequences in the given sequences, as long as the previous iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -55,7 +52,6 @@ export function concatWith( * Concatenates all iterable sequences in the given sequences, as long as the previous iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -78,7 +74,6 @@ export function concatWith( * Concatenates all iterable sequences in the given sequences, as long as the previous iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the first source sequence. * @template T2 The type of the elements in the second source sequence. * @template T3 The type of the elements in the third source sequence. @@ -105,7 +100,6 @@ export function concatWith( * Concatenates all iterable sequences in the given sequences, as long as the previous iterable * sequence terminated successfully. * - * @export * @template T The type of the elements in the sequences. * @param {...Iterable[]} args The iterable sources. * @returns {AsyncIterableX} An iterable sequence that contains the elements of each given sequence, in sequential order. diff --git a/src/iterable/operators/defaultifempty.ts b/src/iterable/operators/defaultifempty.ts index 5469c5f8..88d9128b 100644 --- a/src/iterable/operators/defaultifempty.ts +++ b/src/iterable/operators/defaultifempty.ts @@ -27,7 +27,6 @@ export class DefaultIfEmptyIterable extends IterableX { * Returns the elements of the specified sequence or the default value in a singleton sequence * if the sequence is empty. * - * @export * @template T The type of elements in the source sequence. * @param {T} defaultValue The value to return if the sequence is empty. * @returns {MonoTypeOperatorFunction} An operator which returns the elements of the source sequence or the default value as a singleton. diff --git a/src/iterable/operators/distinct.ts b/src/iterable/operators/distinct.ts index 02061364..03af2fa5 100644 --- a/src/iterable/operators/distinct.ts +++ b/src/iterable/operators/distinct.ts @@ -37,7 +37,6 @@ export class DistinctIterable extends IterableX} [options] The optional arguments for a key selector and comparer function. diff --git a/src/iterable/operators/distinctoptions.ts b/src/iterable/operators/distinctoptions.ts index 1198775c..254b1e0c 100644 --- a/src/iterable/operators/distinctoptions.ts +++ b/src/iterable/operators/distinctoptions.ts @@ -1,7 +1,6 @@ /** * This class holds the options for the distinct operator including a key selector and comparer. * - * @export * @interface DistinctOptions * @template TSource The type of the elements in the source sequence. * @template TKey The type of the discriminator key computed for each element in the source sequence. diff --git a/src/iterable/operators/distinctuntilchanged.ts b/src/iterable/operators/distinctuntilchanged.ts index f5828d8f..1c3785be 100644 --- a/src/iterable/operators/distinctuntilchanged.ts +++ b/src/iterable/operators/distinctuntilchanged.ts @@ -41,7 +41,6 @@ export class DistinctUntilChangedIterable extends Itera /** * Returns an async-iterable sequence that contains only distinct contiguous elements according to the optional keySelector and comparer. * - * @export * @template TSource The type of the elements in the source sequence. * @template TKey The type of the discriminator key computed for each element in the source sequence. * @param {DistinctOptions} [options] The optional options for adding a key selector and comparer. diff --git a/src/iterable/operators/dowhile.ts b/src/iterable/operators/dowhile.ts index e75bedb5..5b11f431 100644 --- a/src/iterable/operators/dowhile.ts +++ b/src/iterable/operators/dowhile.ts @@ -6,7 +6,6 @@ import { MonoTypeOperatorFunction } from '../../interfaces'; /** * Generates an async-iterable sequence by repeating a source sequence as long as the given loop postcondition holds. * - * @export * @template TSource The type of elements in the source sequence. * @param {(() => boolean)} condition Loop condition. * @returns {MonoTypeOperatorFunction} An operator that generates an async-iterable by repeating a diff --git a/src/iterable/operators/endwith.ts b/src/iterable/operators/endwith.ts index 7f7f4648..f221a765 100644 --- a/src/iterable/operators/endwith.ts +++ b/src/iterable/operators/endwith.ts @@ -24,7 +24,6 @@ export class EndWithIterable extends IterableX { /** * Append values to an iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @param {...TSource[]} args The values to append to the end of the iterable sequence. * @returns {MonoTypeOperatorFunction} An operator which appends values to the end of the sequence. diff --git a/src/iterable/operators/except.ts b/src/iterable/operators/except.ts index 8513f588..5474817d 100644 --- a/src/iterable/operators/except.ts +++ b/src/iterable/operators/except.ts @@ -37,7 +37,6 @@ export class ExceptIterable extends IterableX { /** * Produces the set difference of two iterable sequences by using the specified equality comparer to compare values. * - * @export * @template TSource The type of the elements of the input sequences. * @param {Iterable} second An iterable sequence whose elements that also occur in the * operator sequence will cause those elements to be removed from the returned sequence. diff --git a/src/iterable/operators/expand.ts b/src/iterable/operators/expand.ts index d09a4f10..d0b0a7fe 100644 --- a/src/iterable/operators/expand.ts +++ b/src/iterable/operators/expand.ts @@ -26,7 +26,6 @@ export class ExpandIterable extends IterableX { /** * Expands (breadth first) the iterable sequence by recursively applying a selector function to generate more sequences at each recursion level. * - * @export * @template TSource Source sequence element type. * @param {(( value: TSource) => Iterable)} selector Selector function to retrieve the next sequence to expand. * @returns {MonoTypeOperatorFunction} An operator which returns a sequence with results diff --git a/src/iterable/operators/filter.ts b/src/iterable/operators/filter.ts index 74f9fb2a..73be22d4 100644 --- a/src/iterable/operators/filter.ts +++ b/src/iterable/operators/filter.ts @@ -39,7 +39,6 @@ export function filter( /** * Filters the elements of an iterable sequence based on a predicate. * - * @export * @template TSource The type of the elements in the source sequence. * @param {((value: TSource, index: number) => boolean)} predicate A function to test each source element for a condition. * @param {*} [thisArg] Optional this for binding. diff --git a/src/iterable/operators/finalize.ts b/src/iterable/operators/finalize.ts index b70a4d2f..527cfe52 100644 --- a/src/iterable/operators/finalize.ts +++ b/src/iterable/operators/finalize.ts @@ -23,7 +23,6 @@ export class FinallyIterable extends IterableX { /** * Invokes a specified asynchronous action after the source iterable sequence terminates gracefully or exceptionally. * - * @export * @template TSource The type of the elements in the source sequence. * @param {(() => void)} action Action to invoke and await asynchronously after the source iterable sequence terminates * @returns {MonoTypeOperatorFunction} An operator that returns the source sequence with the diff --git a/src/iterable/operators/flat.ts b/src/iterable/operators/flat.ts index f669c432..4acfaa5b 100644 --- a/src/iterable/operators/flat.ts +++ b/src/iterable/operators/flat.ts @@ -39,12 +39,11 @@ export class FlattenIterable extends IterableX { /** * Flattens the nested iterable by the given depth. * - * @export * @template T The type of elements in the source sequence. * @param {number} [depth=Infinity] The depth to flatten the iterable sequence if specified, otherwise infinite. * @returns {MonoTypeOperatorFunction} An operator that flattens the iterable sequence. */ -export function flat(depth: number = Infinity): MonoTypeOperatorFunction { +export function flat(depth = Infinity): MonoTypeOperatorFunction { return function flattenOperatorFunction(source: Iterable): IterableX { return new FlattenIterable(source, depth); }; diff --git a/src/iterable/operators/flatmap.ts b/src/iterable/operators/flatmap.ts index e54ada9f..7994ce5d 100644 --- a/src/iterable/operators/flatmap.ts +++ b/src/iterable/operators/flatmap.ts @@ -27,7 +27,6 @@ export class FlatMapIterable extends IterableX { * Projects each element of an iterable sequence to an iterable sequence and merges * the resulting iterable sequences into one iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @template TResult The type of the elements in the projected inner sequences and the elements in the merged result sequence. * @param {((value: TSource, index: number) => Iterable)} selector A transform function to apply to each element. diff --git a/src/iterable/operators/groupby.ts b/src/iterable/operators/groupby.ts index fa050495..e35801cf 100644 --- a/src/iterable/operators/groupby.ts +++ b/src/iterable/operators/groupby.ts @@ -21,7 +21,7 @@ export class GroupedIterable extends IterableX { } export class GroupByIterable extends IterableX< -GroupedIterable + GroupedIterable > { private _source: Iterable; private _keySelector: (value: TSource) => TKey; @@ -56,7 +56,6 @@ export function groupBy( /** * Groups the elements of an async-iterable sequence and selects the resulting elements by using a specified function. * - * @export * @template TSource The type of the elements in the source sequence. * @template TKey The type of the grouping key computed for each element in the source sequence. * @template TValue The type of the elements within the groups computed for each element in the source sequence. diff --git a/src/iterable/operators/groupjoin.ts b/src/iterable/operators/groupjoin.ts index 6f386e63..286b6333 100644 --- a/src/iterable/operators/groupjoin.ts +++ b/src/iterable/operators/groupjoin.ts @@ -39,7 +39,6 @@ export class GroupJoinIterable extends IterableX< /** * Correlates the elements of two iterable sequences based on equality of keys and groups the results. * - * @export * @template TOuter The type of the elements of the first iterable sequence. * @template TInner The type of the elements of the second iterable sequence. * @template TKey The type of the keys returned by the key selector functions. diff --git a/src/iterable/operators/ignoreelements.ts b/src/iterable/operators/ignoreelements.ts index 2e72ad41..65bc2b5c 100644 --- a/src/iterable/operators/ignoreelements.ts +++ b/src/iterable/operators/ignoreelements.ts @@ -20,7 +20,6 @@ export class IgnoreElementsIterable extends IterableX { /** * Ignores all elements in an iterable sequence leaving only the termination messages. * - * @export * @template TSource The type of the elements in the source sequence * @returns {MonoTypeOperatorFunction} An operator that returns an empty iterable sequence * that signals termination, successful or exceptional, of the source sequence. diff --git a/src/iterable/operators/innerjoin.ts b/src/iterable/operators/innerjoin.ts index 154e1490..725def5d 100644 --- a/src/iterable/operators/innerjoin.ts +++ b/src/iterable/operators/innerjoin.ts @@ -41,7 +41,6 @@ export class JoinIterable extends IterableX extends IterableX { /** * Produces the set intersection of two iterable sequences. * - * @export * @template TSource The type of the elements of the input sequences. * @param {Iterable} second An iterable sequence whose distinct elements that also * appear in the first sequence will be returned. diff --git a/src/iterable/operators/map.ts b/src/iterable/operators/map.ts index 35cfae23..a21a317f 100644 --- a/src/iterable/operators/map.ts +++ b/src/iterable/operators/map.ts @@ -23,7 +23,6 @@ export class MapIterable extends IterableX { /** * Projects each element of an async-enumerable sequence into a new form. * - * @export * @template TSource The type of the elements in the source sequence. * @template TResult The type of the elements in the result sequence, obtained by running the selector * function for each element in the source sequence. diff --git a/src/iterable/operators/memoize.ts b/src/iterable/operators/memoize.ts index 04a101d7..461286d1 100644 --- a/src/iterable/operators/memoize.ts +++ b/src/iterable/operators/memoize.ts @@ -7,7 +7,7 @@ class MemoizeBuffer extends IterableX { private _source: Iterator; private _buffer: IRefCountList; private _error: any; - private _stopped: boolean = false; + private _stopped = false; constructor(source: Iterator, buffer: IRefCountList) { super(); @@ -65,7 +65,6 @@ class MemoizeBuffer extends IterableX { /** * Creates a buffer with a view over the source sequence, causing a specified number of iterators to obtain access * to all of the sequence's elements without causing multiple enumerations over the source. - * @export * @template TSource Source sequence element type. * @param {number} [readerCount] Number of iterators that can access the underlying buffer. * Once every iterator has obtained an element from the buffer, the element is removed from the buffer. @@ -77,7 +76,6 @@ export function memoize(readerCount?: number): OperatorFunction( * Memoizes the source sequence within a selector function where a specified number of iterators can get access * to all of the sequence's elements without causing multiple iterations over the source. * - * @export * @template TSource Source sequence element type. * @template TResult Result sequence element type. * @param {number} [readerCount=-1] Number of iterators that can access the underlying buffer. Once every @@ -106,7 +103,7 @@ export function memoize( * memoized view over the source sequence. */ export function memoize( - readerCount: number = -1, + readerCount = -1, selector?: (value: Iterable) => Iterable ): OperatorFunction { return function memoizeOperatorFunction(source: Iterable): IterableX { @@ -114,9 +111,9 @@ export function memoize( return readerCount === -1 ? new MemoizeBuffer(source[Symbol.iterator](), new MaxRefCountList()) : new MemoizeBuffer( - source[Symbol.iterator](), - new RefCountList(readerCount) - ); + source[Symbol.iterator](), + new RefCountList(readerCount) + ); } return create(() => selector!(memoize(readerCount)(source))[Symbol.iterator]() diff --git a/src/iterable/operators/orderby.ts b/src/iterable/operators/orderby.ts index 329e1e4b..6f8d6070 100644 --- a/src/iterable/operators/orderby.ts +++ b/src/iterable/operators/orderby.ts @@ -88,7 +88,6 @@ export class OrderedIterableX extends OrderedIterableBaseX TKey} keySelector A function to extract a key from an element. @@ -108,7 +107,6 @@ export function orderBy( /** * Sorts the elements of a sequence in descending order according to a key by using a specified comparer. * - * @export * @template TKey The type of the elements of source. * @template TSource The type of the key returned by keySelector. * @param {(item: TSource) => TKey} keySelector A function to extract a key from an element. @@ -128,7 +126,6 @@ export function orderByDescending( /** * Performs a subsequent ordering of the elements in a sequence in ascending order according to a key using a specified comparer. * - * @export * @template TKey The type of the elements of source. * @template TSource The type of the key returned by keySelector. * @param {(item: TSource) => TKey} keySelector A function to extract a key from an element. @@ -155,7 +152,6 @@ export function thenBy( /** * Performs a subsequent ordering of the elements in a sequence in descending order according to a key using a specified comparer. * - * @export * @template TKey The type of the elements of source. * @template TSource The type of the key returned by keySelector. * @param {(item: TSource) => TKey} keySelector A function to extract a key from an element. diff --git a/src/iterable/operators/pairwise.ts b/src/iterable/operators/pairwise.ts index 74b90060..7e96c190 100644 --- a/src/iterable/operators/pairwise.ts +++ b/src/iterable/operators/pairwise.ts @@ -27,7 +27,6 @@ export class PairwiseIterable extends IterableX { * Returns a sequence of each element in the input sequence and its predecessor, with the exception of the * first element which is only returned as the predecessor of the second element. * - * @export * @template TSource The type of the elements in the source sequence. * @returns {OperatorFunction} The result sequence. */ diff --git a/src/iterable/operators/pluck.ts b/src/iterable/operators/pluck.ts index 50c6f5db..eabbbbf6 100644 --- a/src/iterable/operators/pluck.ts +++ b/src/iterable/operators/pluck.ts @@ -22,7 +22,6 @@ function plucker(props: string[], length: number): (x: any) => any { /** * Maps each source value to its specified nested property. * - * @export * @template TSource The type of the elements in the source sequence. * @template TResult The type of the elements in the result sequence, obtained by the property names. * @param {...string[]} args The nested properties to pluck from each source value. diff --git a/src/iterable/operators/publish.ts b/src/iterable/operators/publish.ts index 9b9a5343..c03bb53b 100644 --- a/src/iterable/operators/publish.ts +++ b/src/iterable/operators/publish.ts @@ -7,7 +7,7 @@ class PublishedBuffer extends IterableX { private _buffer: RefCountList; private _source: Iterator; private _error: any; - private _stopped: boolean = false; + private _stopped = false; constructor(source: Iterator) { super(); @@ -75,7 +75,6 @@ class PublishedBuffer extends IterableX { * Creates a buffer with a view over the source sequence, causing each iterator to obtain access to the * remainder of the sequence from the current index in the buffer. * - * @export * @template TSource Source sequence element type. * @returns {OperatorFunction} Buffer enabling each iterator to retrieve elements from * the shared source sequence, starting from the index at the point of obtaining the enumerator. @@ -85,7 +84,6 @@ export function publish(): OperatorFunction; * Buffer enabling each iterator to retrieve elements from the shared source sequence, starting from the * index at the point of obtaining the iterator. * - * @export * @template TSource Source sequence element type. * @template TResult Result sequence element type. * @param {(value: Iterable) => Iterable} [selector] Selector function with published @@ -100,7 +98,6 @@ export function publish( * Buffer enabling each iterator to retrieve elements from the shared source sequence, starting from the * index at the point of obtaining the iterator. * - * @export * @template TSource Source sequence element type. * @template TResult Result sequence element type. * @param {(value: Iterable) => Iterable} [selector] Selector function with published diff --git a/src/iterable/operators/repeat.ts b/src/iterable/operators/repeat.ts index 4cfc80b4..42f84dba 100644 --- a/src/iterable/operators/repeat.ts +++ b/src/iterable/operators/repeat.ts @@ -31,12 +31,11 @@ export class RepeatIterable extends IterableX { /** * Repeats the async-enumerable sequence a specified number of times. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} [count=-1] Number of times to repeat the sequence. If not specified, the sequence repeats indefinitely. * @returns {MonoTypeOperatorFunction} The iterable sequence producing the elements of the given sequence repeatedly. */ -export function repeat(count: number = -1): MonoTypeOperatorFunction { +export function repeat(count = -1): MonoTypeOperatorFunction { return function repeatOperatorFunction(source: Iterable): IterableX { return new RepeatIterable(source, count); }; diff --git a/src/iterable/operators/retry.ts b/src/iterable/operators/retry.ts index 573d5333..768f821e 100644 --- a/src/iterable/operators/retry.ts +++ b/src/iterable/operators/retry.ts @@ -6,13 +6,12 @@ import { MonoTypeOperatorFunction } from '../../interfaces'; /** * Retries the iterable instance the number of given times. If not supplied, it will try infinitely. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} [count=-1] An optional number of times to retry, otherwise is set to infinite retries * @returns {MonoTypeOperatorAsyncFunction} An iterable sequence producing the elements of the * given sequence repeatedly until it terminates successfully. */ -export function retry(count: number = -1): MonoTypeOperatorFunction { +export function retry(count = -1): MonoTypeOperatorFunction { return function retryOperatorFunction(source: Iterable): IterableX { return catchAll(repeatValue>(source, count)); }; diff --git a/src/iterable/operators/reverse.ts b/src/iterable/operators/reverse.ts index 317c4d53..bf281f35 100644 --- a/src/iterable/operators/reverse.ts +++ b/src/iterable/operators/reverse.ts @@ -21,7 +21,6 @@ export class ReverseIterable extends IterableX { /** * Reverses the iterable instance. * - * @export * @template TSource The type of the elements in the source sequence. * @returns {MonoTypeOperatorAsyncFunction} The iterable in reversed sequence. */ diff --git a/src/iterable/operators/scan.ts b/src/iterable/operators/scan.ts index 6bc639aa..91fc0cf9 100644 --- a/src/iterable/operators/scan.ts +++ b/src/iterable/operators/scan.ts @@ -40,7 +40,6 @@ export class ScanIterable extends IterableX { * Applies an accumulator function over an iterable sequence and returns each intermediate result. * The specified seed value, if given, is used as the initial accumulator value. * - * @export * @template T The type of the elements in the source sequence. * @template R The type of the result of the aggregation. * @param {ScanOptions} options The options including the accumulator function and seed. @@ -59,8 +58,10 @@ export function scan( // eslint-disable-next-line no-nested-ternary typeof optionsOrAccumulator === 'function' ? arguments.length > 1 - ? { 'callback': optionsOrAccumulator, 'seed': seed } - : { 'callback': optionsOrAccumulator } + ? // prettier-ignore + { 'callback': optionsOrAccumulator, 'seed': seed } + : // prettier-ignore + { 'callback': optionsOrAccumulator } : optionsOrAccumulator; return function scanOperatorFunction(source: Iterable): IterableX { return new ScanIterable(source, options); diff --git a/src/iterable/operators/scanoptions.ts b/src/iterable/operators/scanoptions.ts index 4cd28bf8..1f54da2d 100644 --- a/src/iterable/operators/scanoptions.ts +++ b/src/iterable/operators/scanoptions.ts @@ -1,7 +1,6 @@ /** * The options for performing a scan operation, including the callback and the optional seed. * - * @export * @interface ScanOptions * @template T The type of the elements in the source sequence. * @template R The type of the result for the reducer callback. diff --git a/src/iterable/operators/scanright.ts b/src/iterable/operators/scanright.ts index 87dcb7c3..655841ca 100644 --- a/src/iterable/operators/scanright.ts +++ b/src/iterable/operators/scanright.ts @@ -38,7 +38,6 @@ export class ScanRightIterable extends IterableX { * Applies an accumulator function over an async-iterable sequence from the right and returns each intermediate result. * The specified seed value, if given, is used as the initial accumulator value. * - * @export * @template T The type of the elements in the source sequence. * @template R The type of the result of the aggregation. * @param {ScanOptions} options The options including the accumulator function and seed. @@ -57,8 +56,10 @@ export function scanRight( // eslint-disable-next-line no-nested-ternary typeof optionsOrAccumulator === 'function' ? arguments.length > 1 - ? { 'callback': optionsOrAccumulator, 'seed': seed } - : { 'callback': optionsOrAccumulator } + ? // prettier-ignore + { 'callback': optionsOrAccumulator, 'seed': seed } + : // prettier-ignore + { 'callback': optionsOrAccumulator } : optionsOrAccumulator; return function scanRightOperatorFunction(source: Iterable): IterableX { return new ScanRightIterable(source, options); diff --git a/src/iterable/operators/share.ts b/src/iterable/operators/share.ts index 0765e69d..c0054bf2 100644 --- a/src/iterable/operators/share.ts +++ b/src/iterable/operators/share.ts @@ -23,7 +23,6 @@ class SharedIterable extends IterableX { * Creates a buffer with a shared view over the source sequence, causing each iterator to fetch the next element * from the source sequence. * - * @export * @template TSource Source sequence element type. * @returns {OperatorAsyncFunction} Buffer enabling each enumerator to retrieve elements from the shared source sequence. */ @@ -32,7 +31,6 @@ export function share(): OperatorFunction; * Shares the source sequence within a selector function where each iterator can fetch the next element from the * source sequence. * - * @export * @template TSource Source sequence element type. * @template TResult Result sequence element type. * @param {((value: Iterable) => Iterable)} [selector] Selector function with shared access @@ -47,7 +45,6 @@ export function share( * Shares the source sequence within a selector function where each iterator can fetch the next element from the * source sequence. * - * @export * @template TSource Source sequence element type. * @template TResult Result sequence element type. * @param {((value: Iterable) => Iterable)} [selector] Selector function with shared access diff --git a/src/iterable/operators/skip.ts b/src/iterable/operators/skip.ts index 04cc580d..842414a3 100644 --- a/src/iterable/operators/skip.ts +++ b/src/iterable/operators/skip.ts @@ -29,7 +29,6 @@ export class SkipIterable extends IterableX { /** * Bypasses a specified number of elements in an iterable sequence and then returns the remaining elements. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} count The number of elements to skip before returning the remaining elements. * @returns {MonoTypeOperatorFunction} An iterable sequence that contains the elements that diff --git a/src/iterable/operators/skiplast.ts b/src/iterable/operators/skiplast.ts index d9405a2b..cac858c2 100644 --- a/src/iterable/operators/skiplast.ts +++ b/src/iterable/operators/skiplast.ts @@ -25,7 +25,6 @@ export class SkipLastIterable extends IterableX { /** * Bypasses a specified number of elements at the end of an iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} count Number of elements to bypass at the end of the source sequence. * @returns {MonoTypeOperatorFunction} An iterable sequence containing the diff --git a/src/iterable/operators/skipwhile.ts b/src/iterable/operators/skipwhile.ts index 3bb819b4..4e9e3700 100644 --- a/src/iterable/operators/skipwhile.ts +++ b/src/iterable/operators/skipwhile.ts @@ -29,7 +29,6 @@ export class SkipWhileIterable extends IterableX { * Bypasses elements in an async-iterale sequence as long as a specified condition is true * and then returns the remaining elements. * - * @export * @template T The type of the elements in the source sequence. * @template S The result of the predicate that is truthy/falsy. * @param {(value: T, index: number) => value is S} predicate A function to test each element for a condition. @@ -43,7 +42,6 @@ export function skipWhile( * Bypasses elements in an async-iterale sequence as long as a specified condition is true * and then returns the remaining elements. * - * @export * @template T The type of the elements in the source sequence. * @param {((value: T, index: number) => boolean)} predicate A function to test each element for a condition. * @returns {OperatorFunction} An iterable sequence that contains the elements from the input @@ -56,7 +54,6 @@ export function skipWhile( * Bypasses elements in an async-iterale sequence as long as a specified condition is true * and then returns the remaining elements. * - * @export * @template T The type of the elements in the source sequence. * @param {((value: T, index: number) => boolean)} predicate A function to test each element for a condition. * @returns {OperatorFunction} An iterable sequence that contains the elements from the input diff --git a/src/iterable/operators/slice.ts b/src/iterable/operators/slice.ts index 29a11e00..95afe4af 100644 --- a/src/iterable/operators/slice.ts +++ b/src/iterable/operators/slice.ts @@ -36,16 +36,12 @@ export class SliceIterable extends IterableX { /** * Returns the elements from the source iterable sequence only after the function that returns a promise produces an element. * - * @export * @template TSource The type of elements in the source sequence. * @param {number} begin Zero-based index at which to begin extraction. * @param {number} [end=Infinity] Zero-based index before which to end extraction. * @returns {MonoTypeOperatorFunction} An iterable containing the extracted elements. */ -export function slice( - begin: number, - end: number = Infinity -): MonoTypeOperatorFunction { +export function slice(begin: number, end = Infinity): MonoTypeOperatorFunction { return function sliceOperatorFunction(source: Iterable): IterableX { return new SliceIterable(source, begin, end); }; diff --git a/src/iterable/operators/startwith.ts b/src/iterable/operators/startwith.ts index ec5da2fb..d8fbc7a2 100644 --- a/src/iterable/operators/startwith.ts +++ b/src/iterable/operators/startwith.ts @@ -24,7 +24,6 @@ export class StartWithIterable extends IterableX { /** * Prepend a value to an iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @param {...TSource[]} args Elements to prepend to the specified sequence. * @returns {MonoTypeOperatorFunction} The source sequence prepended with the specified values. diff --git a/src/iterable/operators/take.ts b/src/iterable/operators/take.ts index 6466124f..77631fb0 100644 --- a/src/iterable/operators/take.ts +++ b/src/iterable/operators/take.ts @@ -27,7 +27,6 @@ export class TakeIterable extends IterableX { /** * Returns a specified number of contiguous elements from the start of an iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} count The number of elements to return. * @returns {MonoTypeOperatorFunction} An iterable sequence that contains the specified diff --git a/src/iterable/operators/takelast.ts b/src/iterable/operators/takelast.ts index 91d6a28f..9825f0db 100644 --- a/src/iterable/operators/takelast.ts +++ b/src/iterable/operators/takelast.ts @@ -31,7 +31,6 @@ export class TakeLastIterable extends IterableX { /** * Returns a specified number of contiguous elements from the end of an iterable sequence. * - * @export * @template TSource The type of the elements in the source sequence. * @param {number} count Number of elements to take from the end of the source sequence. * @returns {MonoTypeOperatorFunction} An iterable sequence containing the specified diff --git a/src/iterable/operators/takewhile.ts b/src/iterable/operators/takewhile.ts index 37544a2d..96b94f1b 100644 --- a/src/iterable/operators/takewhile.ts +++ b/src/iterable/operators/takewhile.ts @@ -25,7 +25,6 @@ export class TakeWhileIterable extends IterableX { /** * Returns elements from an iterable sequence as long as a specified condition is true. * - * @export * @template T The type of the elements in the source sequence. * @template S The result of the predicate that is truthy/falsy. * @param {(value: T, index: number) => value is S} predicate A function to test each element for a condition. @@ -38,7 +37,6 @@ export function takeWhile( /** * Returns elements from an iterable sequence as long as a specified condition is true. * - * @export * @template T The type of the elements in the source sequence. * @param {((value: T, index: number) => boolean)} predicate A function to test each element for a condition. * @returns {OperatorFunction} An iterable sequence that contains the elements from the input sequence that occur @@ -50,7 +48,6 @@ export function takeWhile( /** * Returns elements from an iterable sequence as long as a specified condition is true. * - * @export * @template T The type of the elements in the source sequence. * @param {((value: T, index: number) => boolean)} predicate A function to test each element for a condition. * @returns {OperatorFunction} An iterable sequence that contains the elements from the input sequence that occur diff --git a/src/iterable/operators/tap.ts b/src/iterable/operators/tap.ts index d6f177d3..e12c7901 100644 --- a/src/iterable/operators/tap.ts +++ b/src/iterable/operators/tap.ts @@ -46,7 +46,6 @@ export class TapIterable extends IterableX { * messages through the result sequence. This method can be used for debugging, logging, etc. by * intercepting the message stream to run arbitrary actions for messages on the pipeline. * - * @export * @template TSource The type of the elements in the source sequence. * @param {PartialObserver} observer Observer whose methods to invoke as part of the source sequence's observation. * @returns {MonoTypeOperatorFunction} The source sequence with the side-effecting behavior applied. @@ -58,7 +57,6 @@ export function tap(observer: PartialObserver): MonoTypeOperat * messages through the result sequence. This method can be used for debugging, logging, etc. by * intercepting the message stream to run arbitrary actions for messages on the pipeline. * - * @export * @template TSource The type of the elements in the source sequence. * @param {(((value: TSource) => any) | null)} [next] Function to invoke for each element in the iterable sequence. * @param {(((err: any) => any) | null)} [error] Function to invoke upon exceptional termination of the iterable sequence. @@ -76,7 +74,6 @@ export function tap( * messages through the result sequence. This method can be used for debugging, logging, etc. by * intercepting the message stream to run arbitrary actions for messages on the pipeline. * - * @export * @template TSource The type of the elements in the source sequence. * @param {(PartialObserver | ((value: TSource) => any) | null)} [observerOrNext] Observer whose methods to invoke as * part of the source sequence's observation or a function to invoke for each element in the iterable sequence. diff --git a/src/iterable/operators/union.ts b/src/iterable/operators/union.ts index 275262ff..f25e8064 100644 --- a/src/iterable/operators/union.ts +++ b/src/iterable/operators/union.ts @@ -40,7 +40,6 @@ export class UnionIterable extends IterableX { /** * Produces the set union of two sequences by using the given equality comparer. * - * @export * @template TSource The type of the elements of the input sequences. * @param {AsyncIterable} right An iterable sequence whose distinct elements form the second set for the union. * @param {((x: TSource, y: TSource) => boolean)} [comparer=defaultComparer] The equality comparer to compare values. diff --git a/src/iterable/operators/zipwith.ts b/src/iterable/operators/zipwith.ts index d77c40e2..dc5e7a16 100644 --- a/src/iterable/operators/zipwith.ts +++ b/src/iterable/operators/zipwith.ts @@ -4,7 +4,6 @@ import { ZipIterable } from '../zip'; /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @param {Iterable} source2 The second async-iterable source. @@ -14,7 +13,6 @@ export function zipWith(source2: Iterable): OperatorFunction( /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -47,7 +44,6 @@ export function zipWith( /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -69,7 +65,6 @@ export function zipWith( /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -95,7 +90,6 @@ export function zipWith( /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of elements in the source sequences. * @param {...Iterable[]} sources The source sequences. * @returns {AsyncIterableX} Async iterable with an array of each element from the source sequences in a pairwise fashion. diff --git a/src/iterable/range.ts b/src/iterable/range.ts index 0ef3bc72..f0d7f4b6 100644 --- a/src/iterable/range.ts +++ b/src/iterable/range.ts @@ -20,7 +20,6 @@ class RangeIterable extends IterableX { /** * Generates an iterable sequence of integral numbers within a specified range. * - * @export * @param {number} start The value of the first integer in the sequence. * @param {number} count The number of sequential integers to generate. * @returns {IterableX} An iterable sequence that contains a range of sequential integral numbers. diff --git a/src/iterable/reduce.ts b/src/iterable/reduce.ts index 9a99d5d1..24b96aef 100644 --- a/src/iterable/reduce.ts +++ b/src/iterable/reduce.ts @@ -5,7 +5,6 @@ import { ReduceOptions } from './reduceoptions'; * single element in the result sequence. The seed value, if specified, is used as the initial accumulator value. * For aggregation behavior with incremental intermediate results, scan. * - * @export * @template T The type of the elements in the source sequence. * @template R The type of the result of the aggregation. * @param {Iterable} source An iterable sequence to aggregate over. @@ -27,8 +26,10 @@ export function reduce( // eslint-disable-next-line no-nested-ternary typeof optionsOrAccumulator === 'function' ? arguments.length > 2 - ? { 'callback': optionsOrAccumulator, 'seed': seed } - : { 'callback': optionsOrAccumulator } + ? // prettier-ignore + { 'callback': optionsOrAccumulator, 'seed': seed } + : // prettier-ignore + { 'callback': optionsOrAccumulator } : optionsOrAccumulator; const { ['seed']: _seed, ['callback']: callback } = options; const hasSeed = options.hasOwnProperty('seed'); diff --git a/src/iterable/reduceoptions.ts b/src/iterable/reduceoptions.ts index 58faec03..d408c9c1 100644 --- a/src/iterable/reduceoptions.ts +++ b/src/iterable/reduceoptions.ts @@ -1,3 +1,3 @@ import { ScanOptions } from './operators/scanoptions'; -export interface ReduceOptions extends ScanOptions {} +export type ReduceOptions = ScanOptions; diff --git a/src/iterable/reduceright.ts b/src/iterable/reduceright.ts index f898676d..c77d5bbb 100644 --- a/src/iterable/reduceright.ts +++ b/src/iterable/reduceright.ts @@ -6,7 +6,6 @@ import { ReduceOptions } from './reduceoptions'; * single element in the result sequence. The seed value, if specified, is used as the initial accumulator value. * For aggregation behavior with incremental intermediate results, scan. * - * @export * @template T The type of the elements in the source sequence. * @template R The type of the result of the aggregation. * @param {Iterable} source An iterable sequence to aggregate over. @@ -28,8 +27,10 @@ export function reduceRight( // eslint-disable-next-line no-nested-ternary typeof optionsOrAccumulator === 'function' ? arguments.length > 2 - ? { 'callback': optionsOrAccumulator, 'seed': seed } - : { 'callback': optionsOrAccumulator } + ? // prettier-ignore + { 'callback': optionsOrAccumulator, 'seed': seed } + : // prettier-ignore + { 'callback': optionsOrAccumulator } : optionsOrAccumulator; const { ['seed']: _seed, ['callback']: callback } = options; const hasSeed = options.hasOwnProperty('seed'); diff --git a/src/iterable/repeatvalue.ts b/src/iterable/repeatvalue.ts index 6ee0c191..b46a8ff6 100644 --- a/src/iterable/repeatvalue.ts +++ b/src/iterable/repeatvalue.ts @@ -5,12 +5,11 @@ import { IterableX } from './iterablex'; /** * Repeats a given value for the specified number of times as an iterable. * - * @export * @template TSource The type of element to repeat. * @param {TSource} value The value to repeat as an iterable. * @param {number} [count=-1] The number of times to repeat the value, infinite if not specified. * @returns {AsyncIterableX} An iterable with a single item that is repeated over the specified times. */ -export function repeatValue(value: TSource, count: number = -1): IterableX { +export function repeatValue(value: TSource, count = -1): IterableX { return new RepeatIterable(of(value), count); } diff --git a/src/iterable/sequenceequal.ts b/src/iterable/sequenceequal.ts index e4adea44..cc815f3b 100644 --- a/src/iterable/sequenceequal.ts +++ b/src/iterable/sequenceequal.ts @@ -18,7 +18,6 @@ export interface SequencEqualOptions { /** * Determines whether two sequences are equal by comparing the elements pairwise. * - * @export * @template T The type of the elements in the source sequence. * @param {Iterable} source First iterable sequence to compare. * @param {Iterable} other Second iterable sequence to compare. diff --git a/src/iterable/single.ts b/src/iterable/single.ts index 9ccf1a0d..3005ac1e 100644 --- a/src/iterable/single.ts +++ b/src/iterable/single.ts @@ -5,7 +5,6 @@ import { OptionalFindOptions } from './findoptions'; * or undefined if no such element exists; this method reports an exception if there is more * than one element in the iterable sequence. * - * @export * @template T The type of the elements in the source sequence. * @param {AsyncIterable} source Source iterable sequence. * @param {OptionalFindOptions} [options] The optional options which includes a predicate for filtering, diff --git a/src/iterable/some.ts b/src/iterable/some.ts index 76c6ab92..f8ddcc47 100644 --- a/src/iterable/some.ts +++ b/src/iterable/some.ts @@ -3,7 +3,6 @@ import { FindOptions } from './findoptions'; /** * Determines whether any element of an iterable sequence satisfies a condition. * - * @export * @template T The type of the elements in the source sequence. * @param {Iterable} source An iterable sequence whose elements to apply the predicate to. * @param {FindSubclassedOptions} options The options which includes a required predicate, an optional diff --git a/src/iterable/sum.ts b/src/iterable/sum.ts index e238fcc2..d6b1b31d 100644 --- a/src/iterable/sum.ts +++ b/src/iterable/sum.ts @@ -4,7 +4,6 @@ import { MathOptions } from './mathoptions'; /** * Computes the sum of a sequence of values. * - * @export * @param {AsyncIterable} source A sequence of values to calculate the sum. * @param {MathOptions} [options] Optional options for providing a selector, thisArg and abort signal. * @returns {Promise} A promise containing the sum of the sequence of values. @@ -13,7 +12,6 @@ export function sum(source: Iterable, options?: MathOptions): nu /** * Computes the sum of a sequence of values. * - * @export * @template T The type of values in the source sequence. * @param {Iterable} source A sequence of values to calculate the sum. * @param {MathOptions} [options] Optional options for providing a selector, thisArg and abort signal. @@ -23,7 +21,6 @@ export function sum(source: Iterable, options?: MathOptions): number; /** * Computes the sum of a sequence of values. * - * @export * @param {Iterable} source A sequence of values to calculate the sum. * @param {MathOptions} [options] Optional options for providing a selector, thisArg and abort signal. * @returns {Promise} A promise containing the sum of the sequence of values. diff --git a/src/iterable/throwerror.ts b/src/iterable/throwerror.ts index 2db34ece..732d64e2 100644 --- a/src/iterable/throwerror.ts +++ b/src/iterable/throwerror.ts @@ -16,7 +16,6 @@ class ThrowIterable extends IterableX { /** * Creates an async-iterable that throws the specified error upon iterating. * - * @export * @param {*} error The error to throw upon iterating the iterable. * @returns {AsyncIterableX} An iterable that throws when iterated. */ diff --git a/src/iterable/toarray.ts b/src/iterable/toarray.ts index 474324de..84944afd 100644 --- a/src/iterable/toarray.ts +++ b/src/iterable/toarray.ts @@ -1,7 +1,6 @@ /** * Converts an existing iterable to anarray of values. * - * @export * @template TSource The type of elements in the source sequence. * @param {Iterable} source The source sequence to convert to an array. * @returns {TSource[]} All the items from the source sequence as an array. diff --git a/src/iterable/todomstream.ts b/src/iterable/todomstream.ts index 3f70513b..0c9c4482 100644 --- a/src/iterable/todomstream.ts +++ b/src/iterable/todomstream.ts @@ -4,7 +4,7 @@ import { IterableX } from '../iterable/iterablex'; import { toDOMStream as asyncIterableToDOMStream, ReadableBYOBStreamOptions, - ReadableByteStreamOptions + ReadableByteStreamOptions, } from '../asynciterable/todomstream'; export function toDOMStream( @@ -29,22 +29,22 @@ export function toDOMStream( return asyncIterableToDOMStream(from(source), options); } -IterableX.prototype.tee = function (this: IterableX) { +IterableX.prototype.tee = function (this: IterableX) { return _getDOMStream(this).tee(); }; -IterableX.prototype.pipeTo = function ( +IterableX.prototype.pipeTo = function ( this: IterableX, writable: WritableStream, - options?: PipeOptions + options?: StreamPipeOptions ) { return _getDOMStream(this).pipeTo(writable, options); }; -IterableX.prototype.pipeThrough = function> ( +IterableX.prototype.pipeThrough = function >( this: IterableX, duplex: { writable: WritableStream; readable: R }, - options?: PipeOptions + options?: StreamPipeOptions ) { return _getDOMStream(this).pipeThrough(duplex, options); }; @@ -81,10 +81,10 @@ declare module '../iterable/iterablex' { interface IterableX { toDOMStream: typeof toDOMStreamProto; tee(): [ReadableStream, ReadableStream]; - pipeTo(writable: WritableStream, options?: PipeOptions): Promise; + pipeTo(writable: WritableStream, options?: StreamPipeOptions): Promise; pipeThrough>( duplex: { writable: WritableStream; readable: R }, - options?: PipeOptions + options?: StreamPipeOptions ): ReadableStream; } } diff --git a/src/iterable/tomap.ts b/src/iterable/tomap.ts index 04248175..8cede642 100644 --- a/src/iterable/tomap.ts +++ b/src/iterable/tomap.ts @@ -25,7 +25,6 @@ export interface ToMapOptions { /** * Converts an async-iterable to a map with a key selector and options for an element selector and cancellation. * - * @export * @template TSource The type of elements in the source collection. * @template TKey The type of key used for the map. * @template TElement The type of element to use for the map. diff --git a/src/iterable/tonodestream.ts b/src/iterable/tonodestream.ts index 34383302..b4759d9a 100644 --- a/src/iterable/tonodestream.ts +++ b/src/iterable/tonodestream.ts @@ -7,8 +7,8 @@ const done = (_: any) => null as any; type SourceIterator = Iterator; export class IterableReadable extends Readable { - private _pulling: boolean = false; - private _objectMode: boolean = true; + private _pulling = false; + private _objectMode = true; private _iterator: SourceIterator | undefined; constructor(source: Iterable, options?: ReadableOptions) { super(options); diff --git a/src/iterable/toset.ts b/src/iterable/toset.ts index 941fc733..d3c704ac 100644 --- a/src/iterable/toset.ts +++ b/src/iterable/toset.ts @@ -1,7 +1,6 @@ /** * Converts the existing iterable into a promise which resolves a Set. * - * @export * @template TSource The type of elements in the source sequence. * @param {Iterable} source The iterable to convert into a set. * @returns {Set} A promise which contains a Set with all the elements from the iterable. diff --git a/src/iterable/whiledo.ts b/src/iterable/whiledo.ts index 83884962..027fdc62 100644 --- a/src/iterable/whiledo.ts +++ b/src/iterable/whiledo.ts @@ -21,7 +21,6 @@ class WhileIterable extends IterableX { * Repeats the given source as long as the specified conditions holds, where * the condition is evaluated before each repeated source is iterated. * - * @export * @template TSource * @param {Iterable} source Source to repeat as long as the condition function evaluates to true. * @param {((signal?: AbortSignal) => boolean)} condition Condition that will be evaluated before the source sequence is iterated. diff --git a/src/iterable/zip.ts b/src/iterable/zip.ts index e1f1dbd2..a56c154f 100644 --- a/src/iterable/zip.ts +++ b/src/iterable/zip.ts @@ -30,7 +30,6 @@ export class ZipIterable extends IterableX { /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @param {Iterable} source The first async-iterable source. @@ -41,7 +40,6 @@ export function zip(source: Iterable, source2: Iterable): Iterable /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -58,7 +56,6 @@ export function zip( /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -78,7 +75,6 @@ export function zip( /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -101,7 +97,6 @@ export function zip( /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of the first async-iterable sequence. * @template T2 The type of the second async-iterable sequence. * @template T3 The type of the third async-iterable sequence. @@ -128,7 +123,6 @@ export function zip( /** * Merges multiple iterable sequences into one iterable sequence by combining their elements in a pairwise fashion. * - * @export * @template T The type of elements in the source sequences. * @param {...Iterable[]} sources The source sequences. * @returns {IterableX} Async iterable with an array of each element from the source sequences in a pairwise fashion. diff --git a/src/util/isiterable.ts b/src/util/isiterable.ts index 10be20c2..40dbcd60 100644 --- a/src/util/isiterable.ts +++ b/src/util/isiterable.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/ban-types */ + import { Observable } from '../observer'; /** @ignore */ diff --git a/tsconfig.json b/tsconfig.json index 4ce236ad..1aa66487 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "extends": "./tsconfig/tsconfig.base.json", + "include": ["src/**/*.ts", "spec/**/*.ts"], "formatCodeOptions": { "tabSize": 2, "indentSize": 2 diff --git a/tsconfig/tsconfig.base.json b/tsconfig/tsconfig.base.json index 38e43852..2fe4e103 100644 --- a/tsconfig/tsconfig.base.json +++ b/tsconfig/tsconfig.base.json @@ -9,6 +9,7 @@ "compilerOptions": { "baseUrl": "../", "paths": { + "ix": ["src/Ix.node"], "ix/*": [ "src/*" ] @@ -22,6 +23,7 @@ ], /* Control what is emitted */ "declaration": true, + "declarationMap": true, "noEmitOnError": true, "removeComments": false, "downlevelIteration": true, @@ -43,4 +45,4 @@ "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true } -} \ No newline at end of file +} diff --git a/tsconfig/tsconfig.es2015.cls.json b/tsconfig/tsconfig.es2015.cls.json index fccacb34..28dc355e 100644 --- a/tsconfig/tsconfig.es2015.cls.json +++ b/tsconfig/tsconfig.es2015.cls.json @@ -2,10 +2,11 @@ { "extends": "./tsconfig.base.json", "compilerOptions": { - "target": "ES2015", + "target": "ES2020", "module": "es2015", "declaration": false, + "declarationMap": false, "noEmitHelpers": true, - "importHelpers": true + "importHelpers": false } } diff --git a/tsconfig/tsconfig.es5.cls.json b/tsconfig/tsconfig.es5.cls.json index 4803d8e1..e149ac63 100644 --- a/tsconfig/tsconfig.es5.cls.json +++ b/tsconfig/tsconfig.es5.cls.json @@ -2,10 +2,11 @@ { "extends": "./tsconfig.base.json", "compilerOptions": { - "target": "ES5", + "target": "ES2020", "module": "es2015", "declaration": false, + "declarationMap": false, "noEmitHelpers": true, - "importHelpers": true + "importHelpers": false } } diff --git a/tsconfig/tsconfig.esnext.cls.json b/tsconfig/tsconfig.esnext.cls.json index 03206c9d..839de5cd 100644 --- a/tsconfig/tsconfig.esnext.cls.json +++ b/tsconfig/tsconfig.esnext.cls.json @@ -2,10 +2,11 @@ { "extends": "./tsconfig.base.json", "compilerOptions": { - "target": "ESNEXT", + "target": "ES2020", "module": "es2015", "declaration": false, + "declarationMap": false, "noEmitHelpers": true, - "importHelpers": true + "importHelpers": false } }