immosquare-cleaner 0.1.32 → 0.1.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/immosquare-cleaner/version.rb +1 -1
- data/node_modules/@eslint/eslintrc/README.md +15 -4
- data/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +57 -18
- data/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +1 -1
- data/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +60 -34
- data/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +1 -1
- data/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +3 -16
- data/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +63 -18
- data/node_modules/@eslint/eslintrc/package.json +4 -4
- data/node_modules/@eslint/js/package.json +2 -2
- data/node_modules/@eslint/js/src/configs/eslint-all.js +9 -1
- data/node_modules/@eslint/js/src/configs/eslint-recommended.js +12 -5
- data/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/LICENSE +201 -0
- data/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/README.md +105 -0
- data/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +384 -0
- data/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +27 -0
- data/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/index.d.ts +16 -0
- data/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +12 -0
- data/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js +65 -0
- data/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.js +315 -0
- data/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/package.json +74 -0
- data/node_modules/@humanwhocodes/config-array/api.js +114 -16
- data/node_modules/@humanwhocodes/config-array/package.json +5 -3
- data/node_modules/@humanwhocodes/object-schema/CHANGELOG.md +7 -0
- data/node_modules/@humanwhocodes/object-schema/package.json +6 -1
- data/node_modules/@humanwhocodes/retry/LICENSE +201 -0
- data/node_modules/@humanwhocodes/retry/README.md +122 -0
- data/node_modules/@humanwhocodes/retry/dist/retrier.cjs +267 -0
- data/node_modules/@humanwhocodes/retry/dist/retrier.d.ts +24 -0
- data/node_modules/@humanwhocodes/retry/dist/retrier.js +265 -0
- data/node_modules/@humanwhocodes/retry/dist/retrier.min.js +1 -0
- data/node_modules/@humanwhocodes/retry/dist/retrier.mjs +265 -0
- data/node_modules/@humanwhocodes/retry/package.json +74 -0
- data/node_modules/@types/semver-utils/LICENSE +21 -0
- data/node_modules/@types/semver-utils/README.md +34 -0
- data/node_modules/@types/semver-utils/index.d.ts +15 -0
- data/node_modules/@types/semver-utils/package.json +25 -0
- data/node_modules/acorn/CHANGELOG.md +36 -0
- data/node_modules/acorn/README.md +8 -3
- data/node_modules/acorn/dist/acorn.d.mts +857 -26
- data/node_modules/acorn/dist/acorn.d.ts +833 -268
- data/node_modules/acorn/dist/acorn.js +33 -21
- data/node_modules/acorn/dist/acorn.mjs +33 -21
- data/node_modules/acorn/package.json +1 -1
- data/node_modules/cacheable-request/node_modules/keyv/README.md +429 -0
- data/node_modules/cacheable-request/node_modules/keyv/package.json +57 -0
- data/node_modules/cacheable-request/node_modules/keyv/src/index.d.ts +112 -0
- data/node_modules/cacheable-request/node_modules/keyv/src/index.js +264 -0
- data/node_modules/doctrine/CHANGELOG.md +0 -7
- data/node_modules/doctrine/lib/doctrine.js +1 -0
- data/node_modules/doctrine/package.json +8 -9
- data/node_modules/eslint/README.md +31 -28
- data/node_modules/eslint/bin/eslint.js +4 -3
- data/node_modules/eslint/conf/ecma-version.js +16 -0
- data/node_modules/eslint/conf/globals.js +1 -0
- data/node_modules/eslint/conf/rule-type-list.json +3 -1
- data/node_modules/eslint/lib/api.js +7 -11
- data/node_modules/eslint/lib/cli-engine/cli-engine.js +14 -3
- data/node_modules/eslint/lib/cli-engine/formatters/formatters-meta.json +1 -29
- data/node_modules/eslint/lib/cli-engine/lint-result-cache.js +2 -2
- data/node_modules/eslint/lib/cli.js +115 -36
- data/node_modules/eslint/lib/config/default-config.js +3 -0
- data/node_modules/eslint/lib/config/flat-config-array.js +110 -24
- data/node_modules/eslint/lib/config/flat-config-helpers.js +41 -20
- data/node_modules/eslint/lib/config/flat-config-schema.js +1 -7
- data/node_modules/eslint/lib/config/rule-validator.js +42 -6
- data/node_modules/eslint/lib/eslint/eslint-helpers.js +116 -58
- data/node_modules/eslint/lib/eslint/eslint.js +892 -377
- data/node_modules/eslint/lib/eslint/index.js +2 -2
- data/node_modules/eslint/lib/eslint/legacy-eslint.js +728 -0
- data/node_modules/eslint/lib/linter/apply-disable-directives.js +59 -31
- data/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js +0 -1
- data/node_modules/eslint/lib/linter/code-path-analysis/code-path.js +32 -30
- data/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js +1 -1
- data/node_modules/eslint/lib/linter/config-comment-parser.js +8 -11
- data/node_modules/eslint/lib/linter/index.js +1 -3
- data/node_modules/eslint/lib/linter/interpolate.js +24 -2
- data/node_modules/eslint/lib/linter/linter.js +428 -207
- data/node_modules/eslint/lib/linter/report-translator.js +3 -3
- data/node_modules/eslint/lib/linter/rules.js +6 -15
- data/node_modules/eslint/lib/linter/source-code-fixer.js +1 -1
- data/node_modules/eslint/lib/linter/timing.js +16 -8
- data/node_modules/eslint/lib/options.js +35 -3
- data/node_modules/eslint/lib/rule-tester/index.js +3 -1
- data/node_modules/eslint/lib/rule-tester/rule-tester.js +424 -347
- data/node_modules/eslint/lib/rules/array-bracket-newline.js +1 -1
- data/node_modules/eslint/lib/rules/array-bracket-spacing.js +1 -1
- data/node_modules/eslint/lib/rules/block-scoped-var.js +1 -1
- data/node_modules/eslint/lib/rules/callback-return.js +2 -2
- data/node_modules/eslint/lib/rules/camelcase.js +3 -5
- data/node_modules/eslint/lib/rules/capitalized-comments.js +10 -7
- data/node_modules/eslint/lib/rules/comma-dangle.js +1 -1
- data/node_modules/eslint/lib/rules/comma-style.js +2 -2
- data/node_modules/eslint/lib/rules/complexity.js +14 -1
- data/node_modules/eslint/lib/rules/constructor-super.js +99 -100
- data/node_modules/eslint/lib/rules/default-case.js +1 -1
- data/node_modules/eslint/lib/rules/eol-last.js +2 -2
- data/node_modules/eslint/lib/rules/function-paren-newline.js +2 -2
- data/node_modules/eslint/lib/rules/indent-legacy.js +5 -5
- data/node_modules/eslint/lib/rules/indent.js +5 -5
- data/node_modules/eslint/lib/rules/index.js +1 -2
- data/node_modules/eslint/lib/rules/key-spacing.js +2 -2
- data/node_modules/eslint/lib/rules/line-comment-position.js +1 -1
- data/node_modules/eslint/lib/rules/lines-around-directive.js +2 -2
- data/node_modules/eslint/lib/rules/max-depth.js +1 -1
- data/node_modules/eslint/lib/rules/max-len.js +3 -3
- data/node_modules/eslint/lib/rules/max-lines.js +3 -3
- data/node_modules/eslint/lib/rules/max-nested-callbacks.js +1 -1
- data/node_modules/eslint/lib/rules/max-params.js +1 -1
- data/node_modules/eslint/lib/rules/max-statements.js +1 -1
- data/node_modules/eslint/lib/rules/multiline-comment-style.js +7 -7
- data/node_modules/eslint/lib/rules/new-cap.js +1 -1
- data/node_modules/eslint/lib/rules/newline-after-var.js +1 -1
- data/node_modules/eslint/lib/rules/newline-before-return.js +1 -1
- data/node_modules/eslint/lib/rules/no-case-declarations.js +13 -1
- data/node_modules/eslint/lib/rules/no-constant-binary-expression.js +7 -8
- data/node_modules/eslint/lib/rules/no-constant-condition.js +18 -7
- data/node_modules/eslint/lib/rules/no-constructor-return.js +2 -2
- data/node_modules/eslint/lib/rules/no-dupe-class-members.js +2 -2
- data/node_modules/eslint/lib/rules/no-else-return.js +1 -1
- data/node_modules/eslint/lib/rules/no-empty-function.js +2 -2
- data/node_modules/eslint/lib/rules/no-empty-static-block.js +1 -1
- data/node_modules/eslint/lib/rules/no-extend-native.js +1 -2
- data/node_modules/eslint/lib/rules/no-extra-semi.js +1 -1
- data/node_modules/eslint/lib/rules/no-fallthrough.js +41 -16
- data/node_modules/eslint/lib/rules/no-implicit-coercion.js +66 -24
- data/node_modules/eslint/lib/rules/no-inner-declarations.js +23 -2
- data/node_modules/eslint/lib/rules/no-invalid-regexp.js +1 -1
- data/node_modules/eslint/lib/rules/no-invalid-this.js +1 -1
- data/node_modules/eslint/lib/rules/no-lone-blocks.js +3 -3
- data/node_modules/eslint/lib/rules/no-loss-of-precision.js +1 -1
- data/node_modules/eslint/lib/rules/no-misleading-character-class.js +225 -69
- data/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js +1 -1
- data/node_modules/eslint/lib/rules/no-multiple-empty-lines.js +1 -1
- data/node_modules/eslint/lib/rules/no-new-native-nonconstructor.js +1 -1
- data/node_modules/eslint/lib/rules/no-new-symbol.js +8 -1
- data/node_modules/eslint/lib/rules/no-restricted-globals.js +1 -1
- data/node_modules/eslint/lib/rules/no-restricted-imports.js +186 -40
- data/node_modules/eslint/lib/rules/no-restricted-modules.js +2 -2
- data/node_modules/eslint/lib/rules/no-return-await.js +1 -1
- data/node_modules/eslint/lib/rules/no-sequences.js +1 -0
- data/node_modules/eslint/lib/rules/no-this-before-super.js +45 -13
- data/node_modules/eslint/lib/rules/no-trailing-spaces.js +2 -3
- data/node_modules/eslint/lib/rules/no-unneeded-ternary.js +1 -1
- data/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js +1 -1
- data/node_modules/eslint/lib/rules/no-unused-private-class-members.js +1 -1
- data/node_modules/eslint/lib/rules/no-unused-vars.js +197 -36
- data/node_modules/eslint/lib/rules/no-useless-assignment.js +566 -0
- data/node_modules/eslint/lib/rules/no-useless-backreference.js +1 -1
- data/node_modules/eslint/lib/rules/no-useless-computed-key.js +2 -2
- data/node_modules/eslint/lib/rules/no-useless-return.js +7 -2
- data/node_modules/eslint/lib/rules/object-curly-spacing.js +3 -3
- data/node_modules/eslint/lib/rules/object-property-newline.js +1 -1
- data/node_modules/eslint/lib/rules/one-var.js +5 -5
- data/node_modules/eslint/lib/rules/padded-blocks.js +7 -7
- data/node_modules/eslint/lib/rules/prefer-arrow-callback.js +3 -3
- data/node_modules/eslint/lib/rules/prefer-reflect.js +1 -1
- data/node_modules/eslint/lib/rules/prefer-regex-literals.js +1 -1
- data/node_modules/eslint/lib/rules/prefer-template.js +1 -1
- data/node_modules/eslint/lib/rules/radix.js +2 -2
- data/node_modules/eslint/lib/rules/semi-style.js +1 -1
- data/node_modules/eslint/lib/rules/sort-imports.js +1 -1
- data/node_modules/eslint/lib/rules/sort-keys.js +1 -1
- data/node_modules/eslint/lib/rules/sort-vars.js +1 -1
- data/node_modules/eslint/lib/rules/space-unary-ops.js +1 -1
- data/node_modules/eslint/lib/rules/strict.js +1 -1
- data/node_modules/eslint/lib/rules/use-isnan.js +101 -7
- data/node_modules/eslint/lib/rules/utils/ast-utils.js +16 -7
- data/node_modules/eslint/lib/rules/utils/char-source.js +240 -0
- data/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js +1 -1
- data/node_modules/eslint/lib/rules/utils/unicode/index.js +9 -4
- data/node_modules/eslint/lib/rules/yield-star-spacing.js +1 -1
- data/node_modules/eslint/lib/shared/runtime-info.js +1 -0
- data/node_modules/eslint/lib/shared/serialization.js +55 -0
- data/node_modules/eslint/lib/shared/stats.js +30 -0
- data/node_modules/eslint/lib/shared/string-utils.js +9 -11
- data/node_modules/eslint/lib/shared/types.js +35 -1
- data/node_modules/eslint/lib/source-code/index.js +3 -1
- data/node_modules/eslint/lib/source-code/source-code.js +299 -85
- data/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js +3 -3
- data/node_modules/eslint/lib/source-code/token-store/cursors.js +4 -2
- data/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js +3 -3
- data/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js +3 -3
- data/node_modules/eslint/lib/source-code/token-store/index.js +2 -2
- data/node_modules/eslint/lib/unsupported-api.js +3 -5
- data/node_modules/eslint/messages/no-config-found.js +1 -1
- data/node_modules/eslint/messages/plugin-conflict.js +1 -1
- data/node_modules/eslint/messages/plugin-invalid.js +1 -1
- data/node_modules/eslint/messages/plugin-missing.js +1 -1
- data/node_modules/eslint/package.json +32 -29
- data/node_modules/eslint-scope/README.md +23 -2
- data/node_modules/eslint-scope/dist/eslint-scope.cjs +84 -58
- data/node_modules/eslint-scope/lib/index.js +0 -3
- data/node_modules/eslint-scope/lib/pattern-visitor.js +4 -3
- data/node_modules/eslint-scope/lib/referencer.js +13 -11
- data/node_modules/eslint-scope/lib/scope-manager.js +2 -8
- data/node_modules/eslint-scope/lib/scope.js +64 -43
- data/node_modules/eslint-scope/lib/version.js +1 -1
- data/node_modules/eslint-scope/package.json +21 -19
- data/node_modules/eslint-visitor-keys/README.md +1 -1
- data/node_modules/eslint-visitor-keys/package.json +2 -2
- data/node_modules/espree/README.md +1 -1
- data/node_modules/espree/dist/espree.cjs +1 -1
- data/node_modules/espree/lib/version.js +1 -1
- data/node_modules/espree/package.json +18 -20
- data/node_modules/file-entry-cache/LICENSE +1 -1
- data/node_modules/file-entry-cache/README.md +6 -3
- data/node_modules/file-entry-cache/package.json +19 -43
- data/node_modules/flat-cache/README.md +8 -6
- data/node_modules/flat-cache/changelog.md +155 -205
- data/node_modules/flat-cache/package.json +16 -39
- data/node_modules/flat-cache/src/cache.js +22 -26
- data/node_modules/flat-cache/src/del.js +28 -11
- data/node_modules/flat-cache/src/utils.js +39 -41
- data/node_modules/globals/globals.json +25 -0
- data/node_modules/globals/index.d.ts +2074 -3
- data/node_modules/globals/package.json +10 -7
- data/node_modules/globals/readme.md +2 -14
- data/node_modules/keyv/package.json +4 -4
- data/node_modules/keyv/src/index.js +6 -11
- data/node_modules/npm-check-updates/build/cli.js +22 -21
- data/node_modules/npm-check-updates/build/cli.js.map +1 -1
- data/node_modules/npm-check-updates/build/index-5sFb3Tvv.js +66 -0
- data/node_modules/npm-check-updates/build/index-5sFb3Tvv.js.map +1 -0
- data/node_modules/npm-check-updates/build/index-BmUFwMVL.js +6 -0
- data/node_modules/npm-check-updates/build/index-BmUFwMVL.js.map +1 -0
- data/node_modules/npm-check-updates/build/index.d.ts +5 -2
- data/node_modules/npm-check-updates/build/index.js +560 -1
- data/node_modules/npm-check-updates/build/index.js.map +1 -1
- data/node_modules/npm-check-updates/build/package.json +4 -3
- data/node_modules/npm-check-updates/build/src/index.js +1 -1
- data/node_modules/npm-check-updates/build/src/index.js.map +1 -1
- data/node_modules/npm-check-updates/build/src/lib/libnpmconfig/index.js +2 -2
- data/node_modules/npm-check-updates/build/src/lib/libnpmconfig/index.js.map +1 -1
- data/node_modules/npm-check-updates/build/src/package-managers/bun.js +0 -6
- data/node_modules/npm-check-updates/build/src/package-managers/bun.js.map +1 -1
- data/node_modules/npm-check-updates/package.json +4 -3
- data/node_modules/type-fest/index.d.ts +95 -2
- data/node_modules/type-fest/package.json +12 -18
- data/node_modules/type-fest/readme.md +299 -52
- data/node_modules/type-fest/source/async-return-type.d.ts +4 -2
- data/node_modules/type-fest/source/asyncify.d.ts +5 -3
- data/node_modules/type-fest/source/basic.d.ts +21 -43
- data/node_modules/type-fest/{ts41 → source}/camel-case.d.ts +18 -17
- data/node_modules/type-fest/source/camel-cased-properties-deep.d.ts +54 -0
- data/node_modules/type-fest/source/camel-cased-properties.d.ts +36 -0
- data/node_modules/type-fest/source/conditional-except.d.ts +6 -4
- data/node_modules/type-fest/source/conditional-keys.d.ts +5 -1
- data/node_modules/type-fest/source/conditional-pick.d.ts +5 -3
- data/node_modules/type-fest/{ts41 → source}/delimiter-case.d.ts +16 -8
- data/node_modules/type-fest/source/delimiter-cased-properties-deep.d.ts +60 -0
- data/node_modules/type-fest/source/delimiter-cased-properties.d.ts +37 -0
- data/node_modules/type-fest/source/entries.d.ts +8 -3
- data/node_modules/type-fest/source/entry.d.ts +8 -3
- data/node_modules/type-fest/source/exact.d.ts +73 -0
- data/node_modules/type-fest/source/except.d.ts +38 -3
- data/node_modules/type-fest/source/fixed-length-array.d.ts +6 -1
- data/node_modules/type-fest/source/get.d.ts +184 -0
- data/node_modules/type-fest/source/has-optional-keys.d.ts +21 -0
- data/node_modules/type-fest/source/has-required-keys.d.ts +59 -0
- data/node_modules/type-fest/source/includes.d.ts +22 -0
- data/node_modules/type-fest/source/internal.d.ts +59 -0
- data/node_modules/type-fest/source/invariant-of.d.ts +76 -0
- data/node_modules/type-fest/source/iterable-element.d.ts +8 -0
- data/node_modules/type-fest/source/join.d.ts +30 -0
- data/node_modules/type-fest/source/jsonify.d.ts +90 -0
- data/node_modules/type-fest/{ts41 → source}/kebab-case.d.ts +7 -5
- data/node_modules/type-fest/source/kebab-cased-properties-deep.d.ts +47 -0
- data/node_modules/type-fest/source/kebab-cased-properties.d.ts +30 -0
- data/node_modules/type-fest/source/last-array-element.d.ts +28 -0
- data/node_modules/type-fest/source/literal-to-primitive.d.ts +36 -0
- data/node_modules/type-fest/source/literal-union.d.ts +7 -5
- data/node_modules/type-fest/source/merge-exclusive.d.ts +3 -1
- data/node_modules/type-fest/source/merge.d.ts +8 -3
- data/node_modules/type-fest/source/multidimensional-array.d.ts +43 -0
- data/node_modules/type-fest/source/multidimensional-readonly-array.d.ts +47 -0
- data/node_modules/type-fest/source/mutable.d.ts +4 -21
- data/node_modules/type-fest/source/numeric.d.ts +170 -0
- data/node_modules/type-fest/source/observable-like.d.ts +62 -0
- data/node_modules/type-fest/source/opaque.d.ts +45 -3
- data/node_modules/type-fest/source/optional-keys-of.d.ts +38 -0
- data/node_modules/type-fest/source/package-json.d.ts +64 -12
- data/node_modules/type-fest/source/partial-deep.d.ts +57 -16
- data/node_modules/type-fest/source/partial-on-undefined-deep.d.ts +70 -0
- data/node_modules/type-fest/{ts41 → source}/pascal-case.d.ts +6 -4
- data/node_modules/type-fest/source/pascal-cased-properties-deep.d.ts +54 -0
- data/node_modules/type-fest/source/pascal-cased-properties.d.ts +34 -0
- data/node_modules/type-fest/source/primitive.d.ts +13 -0
- data/node_modules/type-fest/source/promisable.d.ts +5 -3
- data/node_modules/type-fest/source/promise-value.d.ts +9 -7
- data/node_modules/type-fest/source/readonly-deep.d.ts +33 -7
- data/node_modules/type-fest/source/readonly-tuple.d.ts +41 -0
- data/node_modules/type-fest/source/remove-index-signature.d.ts +104 -0
- data/node_modules/type-fest/source/replace.d.ts +67 -0
- data/node_modules/type-fest/source/require-all-or-none.d.ts +36 -0
- data/node_modules/type-fest/source/require-at-least-one.d.ts +5 -3
- data/node_modules/type-fest/source/require-exactly-one.d.ts +4 -5
- data/node_modules/type-fest/source/required-keys-of.d.ts +29 -0
- data/node_modules/type-fest/source/schema.d.ts +72 -0
- data/node_modules/type-fest/source/screaming-snake-case.d.ts +33 -0
- data/node_modules/type-fest/source/set-non-nullable.d.ts +35 -0
- data/node_modules/type-fest/source/set-optional.d.ts +12 -11
- data/node_modules/type-fest/source/set-required.d.ts +12 -11
- data/node_modules/type-fest/source/set-return-type.d.ts +3 -1
- data/node_modules/type-fest/source/simplify.d.ts +83 -0
- data/node_modules/type-fest/{ts41 → source}/snake-case.d.ts +7 -4
- data/node_modules/type-fest/source/snake-cased-properties-deep.d.ts +47 -0
- data/node_modules/type-fest/source/snake-cased-properties.d.ts +30 -0
- data/node_modules/type-fest/source/split.d.ts +29 -0
- data/node_modules/type-fest/source/spread.d.ts +85 -0
- data/node_modules/type-fest/source/string-key-of.d.ts +25 -0
- data/node_modules/type-fest/source/stringified.d.ts +3 -1
- data/node_modules/type-fest/source/trim.d.ts +25 -0
- data/node_modules/type-fest/source/tsconfig-json.d.ts +316 -14
- data/node_modules/type-fest/source/typed-array.d.ts +17 -0
- data/node_modules/type-fest/source/union-to-intersection.d.ts +4 -2
- data/node_modules/type-fest/source/value-of.d.ts +3 -1
- data/node_modules/type-fest/source/writable.d.ts +40 -0
- data/package.json +2 -2
- metadata +86 -63
- data/linters/rubocop-2.7.6.yml +0 -86
- data/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js +0 -66
- data/node_modules/@humanwhocodes/object-schema/tests/object-schema.js +0 -659
- data/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js +0 -186
- data/node_modules/eslint/conf/config-schema.js +0 -93
- data/node_modules/eslint/lib/cli-engine/formatters/checkstyle.js +0 -60
- data/node_modules/eslint/lib/cli-engine/formatters/compact.js +0 -60
- data/node_modules/eslint/lib/cli-engine/formatters/jslint-xml.js +0 -41
- data/node_modules/eslint/lib/cli-engine/formatters/junit.js +0 -82
- data/node_modules/eslint/lib/cli-engine/formatters/tap.js +0 -95
- data/node_modules/eslint/lib/cli-engine/formatters/unix.js +0 -58
- data/node_modules/eslint/lib/cli-engine/formatters/visualstudio.js +0 -63
- data/node_modules/eslint/lib/cli-engine/xml-escape.js +0 -34
- data/node_modules/eslint/lib/eslint/flat-eslint.js +0 -1155
- data/node_modules/eslint/lib/rule-tester/flat-rule-tester.js +0 -1131
- data/node_modules/eslint/lib/rules/require-jsdoc.js +0 -122
- data/node_modules/eslint/lib/rules/utils/patterns/letters.js +0 -36
- data/node_modules/eslint/lib/rules/valid-jsdoc.js +0 -516
- data/node_modules/eslint/lib/shared/config-validator.js +0 -347
- data/node_modules/eslint/lib/shared/deprecation-warnings.js +0 -58
- data/node_modules/eslint/lib/shared/relative-module-resolver.js +0 -50
- data/node_modules/file-entry-cache/changelog.md +0 -163
- data/node_modules/flat-cache/node_modules/rimraf/CHANGELOG.md +0 -65
- data/node_modules/flat-cache/node_modules/rimraf/LICENSE +0 -15
- data/node_modules/flat-cache/node_modules/rimraf/README.md +0 -101
- data/node_modules/flat-cache/node_modules/rimraf/bin.js +0 -68
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/LICENSE +0 -21
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/README.md +0 -378
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/common.js +0 -238
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/glob.js +0 -790
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/node_modules/minimatch/LICENSE +0 -15
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/node_modules/minimatch/README.md +0 -230
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/node_modules/minimatch/minimatch.js +0 -947
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/LICENSE +0 -21
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +0 -129
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +0 -201
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +0 -47
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/node_modules/minimatch/package.json +0 -33
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/package.json +0 -55
- data/node_modules/flat-cache/node_modules/rimraf/node_modules/glob/sync.js +0 -486
- data/node_modules/flat-cache/node_modules/rimraf/package.json +0 -32
- data/node_modules/flat-cache/node_modules/rimraf/rimraf.js +0 -360
- data/node_modules/npm-check-updates/build/index-CI_x-D21.js +0 -593
- data/node_modules/npm-check-updates/build/index-CI_x-D21.js.map +0 -1
- data/node_modules/npm-check-updates/build/index-Ci8A2QXv.js +0 -6
- data/node_modules/npm-check-updates/build/index-Ci8A2QXv.js.map +0 -1
- data/node_modules/npm-check-updates/build/index-DgVn3Gax.js +0 -36
- data/node_modules/npm-check-updates/build/index-DgVn3Gax.js.map +0 -1
- data/node_modules/npm-check-updates/build/src/types/SpawnPleaseOptions.d.ts +0 -6
- data/node_modules/npm-check-updates/build/src/types/SpawnPleaseOptions.js +0 -3
- data/node_modules/npm-check-updates/build/src/types/SpawnPleaseOptions.js.map +0 -1
- data/node_modules/type-fest/base.d.ts +0 -38
- data/node_modules/type-fest/license +0 -9
- data/node_modules/type-fest/source/utilities.d.ts +0 -3
- data/node_modules/type-fest/ts41/index.d.ts +0 -9
@@ -1,4 +1,4 @@
|
|
1
|
-
import {DelimiterCase} from './delimiter-case';
|
1
|
+
import type {DelimiterCase} from './delimiter-case';
|
2
2
|
|
3
3
|
/**
|
4
4
|
Convert a string literal to kebab-case.
|
@@ -7,7 +7,7 @@ This can be useful when, for example, converting a camel-cased object property t
|
|
7
7
|
|
8
8
|
@example
|
9
9
|
```
|
10
|
-
import {KebabCase} from 'type-fest';
|
10
|
+
import type {KebabCase} from 'type-fest';
|
11
11
|
|
12
12
|
// Simple
|
13
13
|
|
@@ -15,7 +15,7 @@ const someVariable: KebabCase<'fooBar'> = 'foo-bar';
|
|
15
15
|
|
16
16
|
// Advanced
|
17
17
|
|
18
|
-
type
|
18
|
+
type KebabCasedProperties<T> = {
|
19
19
|
[K in keyof T as KebabCase<K>]: T[K]
|
20
20
|
};
|
21
21
|
|
@@ -25,12 +25,14 @@ interface CliOptions {
|
|
25
25
|
foo: number;
|
26
26
|
}
|
27
27
|
|
28
|
-
const rawCliOptions:
|
28
|
+
const rawCliOptions: KebabCasedProperties<CliOptions> = {
|
29
29
|
'dry-run': true,
|
30
30
|
'include-file': 'bar.js',
|
31
31
|
foo: 123
|
32
32
|
};
|
33
33
|
```
|
34
|
-
*/
|
35
34
|
|
35
|
+
@category Change case
|
36
|
+
@category Template literal
|
37
|
+
*/
|
36
38
|
export type KebabCase<Value> = DelimiterCase<Value, '-'>;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import type {DelimiterCasedPropertiesDeep} from './delimiter-cased-properties-deep';
|
2
|
+
|
3
|
+
/**
|
4
|
+
Convert object properties to kebab case recursively.
|
5
|
+
|
6
|
+
This can be useful when, for example, converting some API types from a different style.
|
7
|
+
|
8
|
+
@see KebabCase
|
9
|
+
@see KebabCasedProperties
|
10
|
+
|
11
|
+
@example
|
12
|
+
```
|
13
|
+
import type [KebabCasedPropertiesDeep] from 'type-fest';
|
14
|
+
|
15
|
+
interface User {
|
16
|
+
userId: number;
|
17
|
+
userName: string;
|
18
|
+
}
|
19
|
+
|
20
|
+
interface UserWithFriends {
|
21
|
+
userInfo: User;
|
22
|
+
userFriends: User[];
|
23
|
+
}
|
24
|
+
|
25
|
+
const result: KebabCasedPropertiesDeep<UserWithFriends> = {
|
26
|
+
'user-info': {
|
27
|
+
'user-id': 1,
|
28
|
+
'user-name': 'Tom',
|
29
|
+
},
|
30
|
+
'user-friends': [
|
31
|
+
{
|
32
|
+
'user-id': 2,
|
33
|
+
'user-name': 'Jerry',
|
34
|
+
},
|
35
|
+
{
|
36
|
+
'user-id': 3,
|
37
|
+
'user-name': 'Spike',
|
38
|
+
},
|
39
|
+
],
|
40
|
+
};
|
41
|
+
```
|
42
|
+
|
43
|
+
@category Change case
|
44
|
+
@category Template literal
|
45
|
+
@category Object
|
46
|
+
*/
|
47
|
+
export type KebabCasedPropertiesDeep<Value> = DelimiterCasedPropertiesDeep<Value, '-'>;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import type {DelimiterCasedProperties} from './delimiter-cased-properties';
|
2
|
+
|
3
|
+
/**
|
4
|
+
Convert object properties to kebab case but not recursively.
|
5
|
+
|
6
|
+
This can be useful when, for example, converting some API types from a different style.
|
7
|
+
|
8
|
+
@see KebabCase
|
9
|
+
@see KebabCasedPropertiesDeep
|
10
|
+
|
11
|
+
@example
|
12
|
+
```
|
13
|
+
import type {KebabCasedProperties} from 'type-fest';
|
14
|
+
|
15
|
+
interface User {
|
16
|
+
userId: number;
|
17
|
+
userName: string;
|
18
|
+
}
|
19
|
+
|
20
|
+
const result: KebabCasedProperties<User> = {
|
21
|
+
'user-id': 1,
|
22
|
+
'user-name': 'Tom',
|
23
|
+
};
|
24
|
+
```
|
25
|
+
|
26
|
+
@category Change case
|
27
|
+
@category Template literal
|
28
|
+
@category Object
|
29
|
+
*/
|
30
|
+
export type KebabCasedProperties<Value> = DelimiterCasedProperties<Value, '-'>;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/**
|
2
|
+
Extracts the type of the last element of an array.
|
3
|
+
|
4
|
+
Use-case: Defining the return type of functions that extract the last element of an array, for example [`lodash.last`](https://lodash.com/docs/4.17.15#last).
|
5
|
+
|
6
|
+
@example
|
7
|
+
```
|
8
|
+
import type {LastArrayElement} from 'type-fest';
|
9
|
+
|
10
|
+
declare function lastOf<V extends readonly any[]>(array: V): LastArrayElement<V>;
|
11
|
+
|
12
|
+
const array = ['foo', 2];
|
13
|
+
|
14
|
+
typeof lastOf(array);
|
15
|
+
//=> number
|
16
|
+
```
|
17
|
+
|
18
|
+
@category Array
|
19
|
+
@category Template literal
|
20
|
+
*/
|
21
|
+
export type LastArrayElement<ValueType extends readonly unknown[]> =
|
22
|
+
ValueType extends readonly [infer ElementType]
|
23
|
+
? ElementType
|
24
|
+
: ValueType extends readonly [infer _, ...infer Tail]
|
25
|
+
? LastArrayElement<Tail>
|
26
|
+
: ValueType extends ReadonlyArray<infer ElementType>
|
27
|
+
? ElementType
|
28
|
+
: never;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/**
|
2
|
+
Given a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types) return the {@link Primitive | primitive type} it belongs to, or `never` if it's not a primitive.
|
3
|
+
|
4
|
+
Use-case: Working with generic types that may be literal types.
|
5
|
+
|
6
|
+
@example
|
7
|
+
```
|
8
|
+
import type {LiteralToPrimitive} from 'type-fest';
|
9
|
+
|
10
|
+
// No overloads needed to get the correct return type
|
11
|
+
function plus<T extends number | bigint | string>(x: T, y: T): LiteralToPrimitive<T> {
|
12
|
+
return x + (y as any);
|
13
|
+
}
|
14
|
+
|
15
|
+
plus('a', 'b'); // string
|
16
|
+
plus(1, 2); // number
|
17
|
+
plus(1n, 2n); // bigint
|
18
|
+
```
|
19
|
+
|
20
|
+
@category Type
|
21
|
+
*/
|
22
|
+
export type LiteralToPrimitive<T> = T extends number
|
23
|
+
? number
|
24
|
+
: T extends bigint
|
25
|
+
? bigint
|
26
|
+
: T extends string
|
27
|
+
? string
|
28
|
+
: T extends boolean
|
29
|
+
? boolean
|
30
|
+
: T extends symbol
|
31
|
+
? symbol
|
32
|
+
: T extends null
|
33
|
+
? null
|
34
|
+
: T extends undefined
|
35
|
+
? undefined
|
36
|
+
: never;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {Primitive} from './
|
1
|
+
import type {Primitive} from './primitive';
|
2
2
|
|
3
3
|
/**
|
4
4
|
Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
@@ -9,7 +9,7 @@ This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Mi
|
|
9
9
|
|
10
10
|
@example
|
11
11
|
```
|
12
|
-
import {LiteralUnion} from 'type-fest';
|
12
|
+
import type {LiteralUnion} from 'type-fest';
|
13
13
|
|
14
14
|
// Before
|
15
15
|
|
@@ -26,8 +26,10 @@ type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
26
26
|
const pet: Pet2 = '';
|
27
27
|
// You **will** get auto-completion for `dog` and `cat` literals.
|
28
28
|
```
|
29
|
-
|
29
|
+
|
30
|
+
@category Type
|
31
|
+
*/
|
30
32
|
export type LiteralUnion<
|
31
33
|
LiteralType,
|
32
|
-
BaseType extends Primitive
|
33
|
-
> = LiteralType | (BaseType &
|
34
|
+
BaseType extends Primitive,
|
35
|
+
> = LiteralType | (BaseType & Record<never, never>);
|
@@ -10,7 +10,7 @@ This type works with a helper type, called `Without`. `Without<FirstType, Second
|
|
10
10
|
|
11
11
|
@example
|
12
12
|
```
|
13
|
-
import {MergeExclusive} from 'type-fest';
|
13
|
+
import type {MergeExclusive} from 'type-fest';
|
14
14
|
|
15
15
|
interface ExclusiveVariation1 {
|
16
16
|
exclusive1: boolean;
|
@@ -31,6 +31,8 @@ exclusiveOptions = {exclusive2: 'hi'};
|
|
31
31
|
exclusiveOptions = {exclusive1: true, exclusive2: 'hi'};
|
32
32
|
//=> Error
|
33
33
|
```
|
34
|
+
|
35
|
+
@category Object
|
34
36
|
*/
|
35
37
|
export type MergeExclusive<FirstType, SecondType> =
|
36
38
|
(FirstType | SecondType) extends object ?
|
@@ -1,11 +1,14 @@
|
|
1
|
-
import {Except} from './except';
|
1
|
+
import type {Except} from './except';
|
2
|
+
import type {Simplify} from './simplify';
|
3
|
+
|
4
|
+
type Merge_<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
|
2
5
|
|
3
6
|
/**
|
4
7
|
Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
5
8
|
|
6
9
|
@example
|
7
10
|
```
|
8
|
-
import {Merge} from 'type-fest';
|
11
|
+
import type {Merge} from 'type-fest';
|
9
12
|
|
10
13
|
type Foo = {
|
11
14
|
a: number;
|
@@ -18,5 +21,7 @@ type Bar = {
|
|
18
21
|
|
19
22
|
const ab: Merge<Foo, Bar> = {a: 1, b: 2};
|
20
23
|
```
|
24
|
+
|
25
|
+
@category Object
|
21
26
|
*/
|
22
|
-
export type Merge<FirstType, SecondType> =
|
27
|
+
export type Merge<FirstType, SecondType> = Simplify<Merge_<FirstType, SecondType>>;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import type {IsEqual, Subtract} from './internal';
|
2
|
+
|
3
|
+
type Recursive<T> = Array<Recursive<T>>;
|
4
|
+
|
5
|
+
/**
|
6
|
+
Creates a type that represents a multidimensional array of the given type and dimension.
|
7
|
+
|
8
|
+
Use-cases:
|
9
|
+
- Return a n-dimensional array from functions.
|
10
|
+
- Declare a n-dimensional array by defining its dimensions rather than declaring `[]` repetitively.
|
11
|
+
- Infer the dimensions of a n-dimensional array automatically from function arguments.
|
12
|
+
- Avoid the need to know in advance the dimensions of a n-dimensional array allowing them to be dynamic.
|
13
|
+
|
14
|
+
@example
|
15
|
+
```
|
16
|
+
import type {MultidimensionalArray} from 'type-fest';
|
17
|
+
|
18
|
+
function emptyMatrix<T extends number>(dimensions: T): MultidimensionalArray<unknown, T> {
|
19
|
+
const matrix: unknown[] = [];
|
20
|
+
|
21
|
+
let subMatrix = matrix;
|
22
|
+
for (let dimension = 1; dimension < dimensions; ++dimension) {
|
23
|
+
console.log(`Initializing dimension #${dimension}`);
|
24
|
+
|
25
|
+
subMatrix[0] = [];
|
26
|
+
subMatrix = subMatrix[0] as unknown[];
|
27
|
+
}
|
28
|
+
|
29
|
+
return matrix as MultidimensionalArray<unknown, T>;
|
30
|
+
}
|
31
|
+
|
32
|
+
const matrix = emptyMatrix(3);
|
33
|
+
|
34
|
+
matrix[0][0][0] = 42;
|
35
|
+
```
|
36
|
+
|
37
|
+
@category Array
|
38
|
+
*/
|
39
|
+
export type MultidimensionalArray<Element, Dimensions extends number> = number extends Dimensions
|
40
|
+
? Recursive<Element>
|
41
|
+
: IsEqual<Dimensions, 0> extends true
|
42
|
+
? Element
|
43
|
+
: Array<MultidimensionalArray<Element, Subtract<Dimensions, 1>>>;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import type {IsEqual, Subtract} from './internal';
|
2
|
+
|
3
|
+
type Recursive<T> = ReadonlyArray<Recursive<T>>;
|
4
|
+
|
5
|
+
/**
|
6
|
+
Creates a type that represents a multidimensional readonly array that of the given type and dimension.
|
7
|
+
|
8
|
+
Use-cases:
|
9
|
+
- Return a n-dimensional array from functions.
|
10
|
+
- Declare a n-dimensional array by defining its dimensions rather than declaring `[]` repetitively.
|
11
|
+
- Infer the dimensions of a n-dimensional array automatically from function arguments.
|
12
|
+
- Avoid the need to know in advance the dimensions of a n-dimensional array allowing them to be dynamic.
|
13
|
+
|
14
|
+
@example
|
15
|
+
```
|
16
|
+
import type {MultidimensionalReadonlyArray} from 'type-fest';
|
17
|
+
|
18
|
+
function emptyMatrix<T extends number>(dimensions: T): MultidimensionalReadonlyArray<unknown, T> {
|
19
|
+
const matrix: unknown[] = [];
|
20
|
+
|
21
|
+
let subMatrix = matrix;
|
22
|
+
for (let dimension = 1; dimension < dimensions; ++dimension) {
|
23
|
+
console.log(`Initializing dimension #${dimension}`);
|
24
|
+
|
25
|
+
subMatrix[0] = [];
|
26
|
+
if (dimension < dimensions - 1) {
|
27
|
+
subMatrix = subMatrix[0] as unknown[];
|
28
|
+
} else {
|
29
|
+
subMatrix[0] = 42;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
return matrix as MultidimensionalReadonlyArray<unknown, T>;
|
34
|
+
}
|
35
|
+
|
36
|
+
const matrix = emptyMatrix(3);
|
37
|
+
|
38
|
+
const answer = matrix[0][0][0]; // 42
|
39
|
+
```
|
40
|
+
|
41
|
+
@category Array
|
42
|
+
*/
|
43
|
+
export type MultidimensionalReadonlyArray<Element, Dimensions extends number> = number extends Dimensions
|
44
|
+
? Recursive<Element>
|
45
|
+
: IsEqual<Dimensions, 0> extends true
|
46
|
+
? Element
|
47
|
+
: ReadonlyArray<MultidimensionalReadonlyArray<Element, Subtract<Dimensions, 1>>>;
|
@@ -1,22 +1,5 @@
|
|
1
|
-
|
2
|
-
Convert an object with `readonly` keys into a mutable object. Inverse of `Readonly<T>`.
|
1
|
+
import type {Writable} from './writable';
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
```
|
8
|
-
import {Mutable} from 'type-fest';
|
9
|
-
|
10
|
-
type Foo = {
|
11
|
-
readonly a: number;
|
12
|
-
readonly b: string;
|
13
|
-
};
|
14
|
-
|
15
|
-
const mutableFoo: Mutable<Foo> = {a: 1, b: '2'};
|
16
|
-
mutableFoo.a = 3;
|
17
|
-
```
|
18
|
-
*/
|
19
|
-
export type Mutable<ObjectType> = {
|
20
|
-
// For each `Key` in the keys of `ObjectType`, make a mapped type by removing the `readonly` modifier from the key.
|
21
|
-
-readonly [KeyType in keyof ObjectType]: ObjectType[KeyType];
|
22
|
-
};
|
3
|
+
/** @deprecated @see Writable */
|
4
|
+
export type Mutable<BaseType, Keys extends keyof BaseType = keyof BaseType> =
|
5
|
+
Writable<BaseType, Keys>;
|
@@ -0,0 +1,170 @@
|
|
1
|
+
type Numeric = number | bigint;
|
2
|
+
|
3
|
+
type Zero = 0 | 0n;
|
4
|
+
|
5
|
+
/**
|
6
|
+
Matches the hidden `Infinity` type.
|
7
|
+
|
8
|
+
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/32277) if you want to have this type as a built-in in TypeScript.
|
9
|
+
|
10
|
+
@see NegativeInfinity
|
11
|
+
|
12
|
+
@category Numeric
|
13
|
+
*/
|
14
|
+
// See https://github.com/microsoft/TypeScript/issues/31752
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
16
|
+
export type PositiveInfinity = 1e999;
|
17
|
+
|
18
|
+
/**
|
19
|
+
Matches the hidden `-Infinity` type.
|
20
|
+
|
21
|
+
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/32277) if you want to have this type as a built-in in TypeScript.
|
22
|
+
|
23
|
+
@see PositiveInfinity
|
24
|
+
|
25
|
+
@category Numeric
|
26
|
+
*/
|
27
|
+
// See https://github.com/microsoft/TypeScript/issues/31752
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
29
|
+
export type NegativeInfinity = -1e999;
|
30
|
+
|
31
|
+
/**
|
32
|
+
A finite `number`.
|
33
|
+
You can't pass a `bigint` as they are already guaranteed to be finite.
|
34
|
+
|
35
|
+
Use-case: Validating and documenting parameters.
|
36
|
+
|
37
|
+
Note: This can't detect `NaN`, please upvote [this issue](https://github.com/microsoft/TypeScript/issues/28682) if you want to have this type as a built-in in TypeScript.
|
38
|
+
|
39
|
+
@example
|
40
|
+
```
|
41
|
+
import type {Finite} from 'type-fest';
|
42
|
+
|
43
|
+
declare function setScore<T extends number>(length: Finite<T>): void;
|
44
|
+
```
|
45
|
+
|
46
|
+
@category Numeric
|
47
|
+
*/
|
48
|
+
export type Finite<T extends number> = T extends PositiveInfinity | NegativeInfinity ? never : T;
|
49
|
+
|
50
|
+
/**
|
51
|
+
A `number` that is an integer.
|
52
|
+
You can't pass a `bigint` as they are already guaranteed to be integers.
|
53
|
+
|
54
|
+
Use-case: Validating and documenting parameters.
|
55
|
+
|
56
|
+
@example
|
57
|
+
```
|
58
|
+
import type {Integer} from 'type-fest';
|
59
|
+
|
60
|
+
declare function setYear<T extends number>(length: Integer<T>): void;
|
61
|
+
```
|
62
|
+
|
63
|
+
@see NegativeInteger
|
64
|
+
@see NonNegativeInteger
|
65
|
+
|
66
|
+
@category Numeric
|
67
|
+
*/
|
68
|
+
// `${bigint}` is a type that matches a valid bigint literal without the `n` (ex. 1, 0b1, 0o1, 0x1)
|
69
|
+
// Because T is a number and not a string we can effectively use this to filter out any numbers containing decimal points
|
70
|
+
export type Integer<T extends number> = `${T}` extends `${bigint}` ? T : never;
|
71
|
+
|
72
|
+
/**
|
73
|
+
A `number` that is not an integer.
|
74
|
+
You can't pass a `bigint` as they are already guaranteed to be integers.
|
75
|
+
|
76
|
+
Use-case: Validating and documenting parameters.
|
77
|
+
|
78
|
+
@example
|
79
|
+
```
|
80
|
+
import type {Float} from 'type-fest';
|
81
|
+
|
82
|
+
declare function setPercentage<T extends number>(length: Float<T>): void;
|
83
|
+
```
|
84
|
+
|
85
|
+
@see Integer
|
86
|
+
|
87
|
+
@category Numeric
|
88
|
+
*/
|
89
|
+
export type Float<T extends number> = T extends Integer<T> ? never : T;
|
90
|
+
|
91
|
+
/**
|
92
|
+
A negative (`-∞ < x < 0`) `number` that is not an integer.
|
93
|
+
Equivalent to `Negative<Float<T>>`.
|
94
|
+
|
95
|
+
Use-case: Validating and documenting parameters.
|
96
|
+
|
97
|
+
@see Negative
|
98
|
+
@see Float
|
99
|
+
|
100
|
+
@category Numeric
|
101
|
+
*/
|
102
|
+
export type NegativeFloat<T extends number> = Negative<Float<T>>;
|
103
|
+
|
104
|
+
/**
|
105
|
+
A negative `number`/`bigint` (`-∞ < x < 0`)
|
106
|
+
|
107
|
+
Use-case: Validating and documenting parameters.
|
108
|
+
|
109
|
+
@see NegativeInteger
|
110
|
+
@see NonNegative
|
111
|
+
|
112
|
+
@category Numeric
|
113
|
+
*/
|
114
|
+
export type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never;
|
115
|
+
|
116
|
+
/**
|
117
|
+
A negative (`-∞ < x < 0`) `number` that is an integer.
|
118
|
+
Equivalent to `Negative<Integer<T>>`.
|
119
|
+
|
120
|
+
You can't pass a `bigint` as they are already guaranteed to be integers, instead use `Negative<T>`.
|
121
|
+
|
122
|
+
Use-case: Validating and documenting parameters.
|
123
|
+
|
124
|
+
@see Negative
|
125
|
+
@see Integer
|
126
|
+
|
127
|
+
@category Numeric
|
128
|
+
*/
|
129
|
+
export type NegativeInteger<T extends number> = Negative<Integer<T>>;
|
130
|
+
|
131
|
+
/**
|
132
|
+
A non-negative `number`/`bigint` (`0 <= x < ∞`).
|
133
|
+
|
134
|
+
Use-case: Validating and documenting parameters.
|
135
|
+
|
136
|
+
@see NonNegativeInteger
|
137
|
+
@see Negative
|
138
|
+
|
139
|
+
@example
|
140
|
+
```
|
141
|
+
import type {NonNegative} from 'type-fest';
|
142
|
+
|
143
|
+
declare function setLength<T extends number>(length: NonNegative<T>): void;
|
144
|
+
```
|
145
|
+
|
146
|
+
@category Numeric
|
147
|
+
*/
|
148
|
+
export type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : never;
|
149
|
+
|
150
|
+
/**
|
151
|
+
A non-negative (`0 <= x < ∞`) `number` that is an integer.
|
152
|
+
Equivalent to `NonNegative<Integer<T>>`.
|
153
|
+
|
154
|
+
You can't pass a `bigint` as they are already guaranteed to be integers, instead use `NonNegative<T>`.
|
155
|
+
|
156
|
+
Use-case: Validating and documenting parameters.
|
157
|
+
|
158
|
+
@see NonNegative
|
159
|
+
@see Integer
|
160
|
+
|
161
|
+
@example
|
162
|
+
```
|
163
|
+
import type {NonNegativeInteger} from 'type-fest';
|
164
|
+
|
165
|
+
declare function setLength<T extends number>(length: NonNegativeInteger<T>): void;
|
166
|
+
```
|
167
|
+
|
168
|
+
@category Numeric
|
169
|
+
*/
|
170
|
+
export type NonNegativeInteger<T extends number> = NonNegative<Integer<T>>;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
declare global {
|
2
|
+
interface SymbolConstructor {
|
3
|
+
readonly observable: symbol;
|
4
|
+
}
|
5
|
+
}
|
6
|
+
|
7
|
+
/**
|
8
|
+
@remarks
|
9
|
+
The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
|
10
|
+
As well, some guideance on making an `Observable` do not include `closed` propery.
|
11
|
+
@see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
|
12
|
+
@see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
|
13
|
+
@see https://github.com/benlesh/symbol-observable#making-an-object-observable
|
14
|
+
|
15
|
+
@category Observable
|
16
|
+
*/
|
17
|
+
export type Unsubscribable = {
|
18
|
+
unsubscribe(): void;
|
19
|
+
};
|
20
|
+
|
21
|
+
/**
|
22
|
+
@category Observable
|
23
|
+
*/
|
24
|
+
type OnNext<ValueType> = (value: ValueType) => void;
|
25
|
+
/**
|
26
|
+
@category Observable
|
27
|
+
*/
|
28
|
+
type OnError = (error: unknown) => void;
|
29
|
+
/**
|
30
|
+
@category Observable
|
31
|
+
*/
|
32
|
+
type OnComplete = () => void;
|
33
|
+
|
34
|
+
/**
|
35
|
+
@category Observable
|
36
|
+
*/
|
37
|
+
export type Observer<ValueType> = {
|
38
|
+
next: OnNext<ValueType>;
|
39
|
+
error: OnError;
|
40
|
+
complete: OnComplete;
|
41
|
+
};
|
42
|
+
|
43
|
+
/**
|
44
|
+
Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
|
45
|
+
|
46
|
+
@remarks
|
47
|
+
The TC39 Observable proposal defines 2 forms of `subscribe()`:
|
48
|
+
1. Three callback arguments: `subscribe(observer: OnNext<ValueType>, onError?: OnError, onComplete?: OnComplete): Unsubscribable;`
|
49
|
+
2. A single `observer` argument: (as defined below)
|
50
|
+
|
51
|
+
But `Observable` implementations have evolved to preferring case 2 and some implementations choose not to implement case 1. Therefore, an `ObservableLike` cannot be trusted to implement the first case. (xstream and hand built observerables often do not implement case 1)
|
52
|
+
|
53
|
+
@see https://github.com/tc39/proposal-observable#observable
|
54
|
+
@see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L246-L259
|
55
|
+
@see https://benlesh.com/posts/learning-observable-by-building-observable/
|
56
|
+
|
57
|
+
@category Observable
|
58
|
+
*/
|
59
|
+
export interface ObservableLike<ValueType = unknown> {
|
60
|
+
subscribe(observer?: Partial<Observer<ValueType>>): Unsubscribable;
|
61
|
+
[Symbol.observable](): ObservableLike<ValueType>;
|
62
|
+
}
|
@@ -1,3 +1,9 @@
|
|
1
|
+
declare const tag: unique symbol;
|
2
|
+
|
3
|
+
declare type Tagged<Token> = {
|
4
|
+
readonly [tag]: Token;
|
5
|
+
};
|
6
|
+
|
1
7
|
/**
|
2
8
|
Create an opaque type, which hides its internal details from the public, and can only be created by being used explicitly.
|
3
9
|
|
@@ -6,17 +12,18 @@ The generic type parameter can be anything. It doesn't have to be an object.
|
|
6
12
|
[Read more about opaque types.](https://codemix.com/opaque-types-in-javascript/)
|
7
13
|
|
8
14
|
There have been several discussions about adding this feature to TypeScript via the `opaque type` operator, similar to how Flow does it. Unfortunately, nothing has (yet) moved forward:
|
15
|
+
- [Microsoft/TypeScript#202](https://github.com/microsoft/TypeScript/issues/202)
|
9
16
|
- [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408)
|
10
17
|
- [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807)
|
11
18
|
|
12
19
|
@example
|
13
20
|
```
|
14
|
-
import {Opaque} from 'type-fest';
|
21
|
+
import type {Opaque} from 'type-fest';
|
15
22
|
|
16
23
|
type AccountNumber = Opaque<number, 'AccountNumber'>;
|
17
24
|
type AccountBalance = Opaque<number, 'AccountBalance'>;
|
18
25
|
|
19
|
-
// The Token parameter allows the compiler to differentiate between types, whereas "unknown" will not. For example, consider the following structures:
|
26
|
+
// The `Token` parameter allows the compiler to differentiate between types, whereas "unknown" will not. For example, consider the following structures:
|
20
27
|
type ThingOne = Opaque<string>;
|
21
28
|
type ThingTwo = Opaque<string>;
|
22
29
|
|
@@ -61,5 +68,40 @@ type Person = {
|
|
61
68
|
name: string;
|
62
69
|
};
|
63
70
|
```
|
71
|
+
|
72
|
+
@category Type
|
73
|
+
*/
|
74
|
+
export type Opaque<Type, Token = unknown> = Type & Tagged<Token>;
|
75
|
+
|
76
|
+
/**
|
77
|
+
Revert an opaque type back to its original type by removing the readonly `[tag]`.
|
78
|
+
|
79
|
+
Why is this necessary?
|
80
|
+
|
81
|
+
1. Use an `Opaque` type as object keys
|
82
|
+
2. Prevent TS4058 error: "Return type of exported function has or is using name X from external module Y but cannot be named"
|
83
|
+
|
84
|
+
@example
|
85
|
+
```
|
86
|
+
import type {Opaque, UnwrapOpaque} from 'type-fest';
|
87
|
+
|
88
|
+
type AccountType = Opaque<'SAVINGS' | 'CHECKING', 'AccountType'>;
|
89
|
+
|
90
|
+
const moneyByAccountType: Record<UnwrapOpaque<AccountType>, number> = {
|
91
|
+
SAVINGS: 99,
|
92
|
+
CHECKING: 0.1
|
93
|
+
};
|
94
|
+
|
95
|
+
// Without UnwrapOpaque, the following expression would throw a type error.
|
96
|
+
const money = moneyByAccountType.SAVINGS; // TS error: Property 'SAVINGS' does not exist
|
97
|
+
|
98
|
+
// Attempting to pass an non-Opaque type to UnwrapOpaque will raise a type error.
|
99
|
+
type WontWork = UnwrapOpaque<string>;
|
100
|
+
```
|
101
|
+
|
102
|
+
@category Type
|
64
103
|
*/
|
65
|
-
export type
|
104
|
+
export type UnwrapOpaque<OpaqueType extends Tagged<unknown>> =
|
105
|
+
OpaqueType extends Opaque<infer Type, OpaqueType[typeof tag]>
|
106
|
+
? Type
|
107
|
+
: OpaqueType;
|