diff --git a/package.json b/package.json index 8df31a4d..a3dda87d 100644 --- a/package.json +++ b/package.json @@ -23,13 +23,13 @@ "build": "yarn clear && concurrently 'yarn:build:*'", "test": "node --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info --test '**/*.test.*'", "lint": "concurrently 'yarn:lint:*'", - "lint:tsc": "tsc --noEmit", + "lint:tsc": "tsc -b --noEmit", "lint:biome": "biome check", "prepublishOnly": "yarn build", "publish-package": "yarn install --check-files && yarn publish --non-interactive", "swc-base": "swc src/ --config-file package.swcrc --strip-leading-paths", "build:es6": "yarn swc-base -d lib", - "build:types": "cross-env NODE_ENV=production tsc --project tsconfig.build.json", + "build:types": "cross-env NODE_ENV=production tsc --project tsconfig.lib.json", "size": "yarn build && size-limit", "docs": "typedoc" }, @@ -91,7 +91,7 @@ "ts-node": "^10.9.2", "typedoc": "^0.28.18", "typedoc-plugin-mdn-links": "^5.1.1", - "typescript": "^5.8.3" + "typescript": "^6.0.2" }, "dependencies": { "@swc/helpers": "^0.5.20", diff --git a/src/array/arrays.ts b/src/array/arrays.ts index a350d1c2..fd1b8e64 100644 --- a/src/array/arrays.ts +++ b/src/array/arrays.ts @@ -153,7 +153,8 @@ export function omitFromArray(array: T[] = [], value: T): T[] { */ export function difference(array1: readonly T[] = [], array2: readonly T[] = []): T[] { return array1.reduce((res, item) => { - if (!array2.includes(item)) { + // TODO: после поднятия таргета es, необходимо заменить на includes + if (!array2.some((value) => (Number.isNaN(value) && Number.isNaN(item)) || value === item)) { res.push(item); } return res; diff --git a/src/other/functions.ts b/src/other/functions.ts index 7a0f1ccf..afce51a4 100644 --- a/src/other/functions.ts +++ b/src/other/functions.ts @@ -28,7 +28,7 @@ export const noop = (): void => { export function once unknown>(fn: T) { // TODO: once должна кэшировать данные, но она это не делает let called = false; - return function (...args) { + return function (this: unknown, ...args) { if (called) { return; } diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 701dc52f..00000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "declaration": true, - "emitDeclarationOnly": true - }, - "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"] -} diff --git a/tsconfig.json b/tsconfig.json index 4db931b1..81e9f936 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,44 +1,4 @@ { - "compilerOptions": { - "module": "nodenext", - "target": "es5", - "lib": ["es5", "es2015", "dom"], - "moduleResolution": "nodenext", - "allowImportingTsExtensions": true, - "noEmit": true, - "noImplicitAny": true, - "removeComments": true, - "preserveConstEnums": true, - "strictNullChecks": true, - "declaration": true, - "declarationMap": true, - "declarationDir": "lib", - "sourceMap": false, - "baseUrl": "src", - "esModuleInterop": true, - "emitDeclarationOnly": true, - "isolatedDeclarations": true, - "skipLibCheck": true, - "rewriteRelativeImportExtensions": true, - "erasableSyntaxOnly": true, - "verbatimModuleSyntax": true - }, - "include": ["src/**/*.ts"], - "exclude": ["node_modules"], - "typedocOptions": { - "readme": "README.md", - "plugin": ["typedoc-plugin-mdn-links"], - "entryPoints": [ - "src/animation/index.ts", - "src/array/index.ts", - "src/async/index.ts", - "src/datetime/index.ts", - "src/device/index.ts", - "src/html/index.ts", - "src/other/index.ts", - "src/text/index.ts", - "src/typecheck/index.ts" - ], - "out": "docs" - } + "files": [], + "references": [{ "path": "./tsconfig.lib.json" }, { "path": "./tsconfig.node.json" }] } diff --git a/tsconfig.lib.json b/tsconfig.lib.json new file mode 100644 index 00000000..e66120cf --- /dev/null +++ b/tsconfig.lib.json @@ -0,0 +1,44 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.lib.tsbuildinfo", + "module": "nodenext", + "target": "es2015", + "lib": ["es2015", "dom"], + "moduleResolution": "nodenext", + "allowImportingTsExtensions": true, + "noEmit": true, + "noImplicitAny": true, + "removeComments": true, + "preserveConstEnums": true, + "strictNullChecks": true, + "declaration": true, + "declarationMap": true, + "declarationDir": "lib", + "sourceMap": false, + "esModuleInterop": true, + "emitDeclarationOnly": true, + "isolatedDeclarations": true, + "skipLibCheck": true, + "rewriteRelativeImportExtensions": true, + "erasableSyntaxOnly": true, + "verbatimModuleSyntax": true + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules", "src/**/*test.ts"], + "typedocOptions": { + "readme": "README.md", + "plugin": ["typedoc-plugin-mdn-links"], + "entryPoints": [ + "src/animation/index.ts", + "src/array/index.ts", + "src/async/index.ts", + "src/datetime/index.ts", + "src/device/index.ts", + "src/html/index.ts", + "src/other/index.ts", + "src/text/index.ts", + "src/typecheck/index.ts" + ], + "out": "docs" + } +} diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 00000000..dd580a34 --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ESNext", + "lib": ["ESNext", "dom"], + "module": "nodenext", + "types": ["node"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "nodenext", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + "rewriteRelativeImportExtensions": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true, + "noImplicitAny": true, + "preserveConstEnums": true, + "strictNullChecks": true + }, + "include": ["src/**/*test.ts"] +} diff --git a/yarn.lock b/yarn.lock index a211e7cb..ef32a7c9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2465,10 +2465,10 @@ typedoc@^0.28.18: minimatch "^10.2.4" yaml "^2.8.2" -typescript@^5.8.3: - version "5.9.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" - integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== +typescript@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.2.tgz#0b1bfb15f68c64b97032f3d78abbf98bdbba501f" + integrity sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ== uc.micro@^2.0.0, uc.micro@^2.1.0: version "2.1.0"