From 3571837b8bb6d76102b41e9357b50c775f1fd460 Mon Sep 17 00:00:00 2001 From: Taye Adeyemi Date: Thu, 28 Mar 2024 18:30:22 +0100 Subject: [PATCH] fix(types): fix issues with `skipLibCheck: false` Close #1025 Close #1028 # Conflicts: # packages/@interactjs/arrange/start.ts # packages/@interactjs/feedback/pointers.ts # packages/@interactjs/symbol-tree/SymbolTree.ts # packages/@interactjs/symbol-tree/package.json --- CHANGELOG.md | 4 ++++ esnext.rollup.config.cjs | 2 +- package.json | 2 -- packages/@interactjs/core/BaseEvent.ts | 2 +- packages/@interactjs/core/Interaction.ts | 2 +- packages/@interactjs/core/scope.ts | 6 +++++- scripts/bin/clean.js | 3 +-- test/fixtures/dependentTsProject/tsconfig.json | 2 +- types.tsconfig.json | 2 +- yarn.lock | 5 ----- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abd62e5da..b48a59f2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.10.27 + +- fix(types): fix issues with `skipLibCheck: false` + ## v1.10.26 - fix: improve build; check output for ES2018 compatibility diff --git a/esnext.rollup.config.cjs b/esnext.rollup.config.cjs index 10c2fe3f8..c83ebae52 100644 --- a/esnext.rollup.config.cjs +++ b/esnext.rollup.config.cjs @@ -20,7 +20,7 @@ const { isPro, } = require('./scripts/utils') -const BUNDLED_DEPS = ['rebound', 'symbol-tree'] +const BUNDLED_DEPS = ['rebound'] const INPUT_EXTENSIONS = ['.ts', '.tsx', '.vue'] const moduleDirectory = getModuleDirectories() diff --git a/package.json b/package.json index ad1c2136b..4a2afdefa 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ "@types/node": "^17.0.42", "@types/react": "^18.2.43", "@types/shelljs": "^0.8.11", - "@types/symbol-tree": "^3.2.3", "@typescript-eslint/eslint-plugin": "^6.13.2", "@typescript-eslint/parser": "^6.13.2", "@vitejs/plugin-vue": "^4.5.2", @@ -90,7 +89,6 @@ "stylelint-config-html": "^1.1.0", "stylelint-config-recess-order": "^4.2.0", "stylelint-config-standard": "^35.0.0", - "symbol-tree": "^3.2.4", "temp": "^0.9.4", "ts-node": "^10.9.2", "typedoc": "^0.25.4", diff --git a/packages/@interactjs/core/BaseEvent.ts b/packages/@interactjs/core/BaseEvent.ts index 02f19600f..9f04f8c87 100644 --- a/packages/@interactjs/core/BaseEvent.ts +++ b/packages/@interactjs/core/BaseEvent.ts @@ -36,7 +36,7 @@ export class BaseEvent { // defined outside of class definition to avoid assignment of undefined during // construction -export interface BaseEvent { +export interface BaseEvent { interaction: InteractionProxy } diff --git a/packages/@interactjs/core/Interaction.ts b/packages/@interactjs/core/Interaction.ts index 0583e4af8..94fd81625 100644 --- a/packages/@interactjs/core/Interaction.ts +++ b/packages/@interactjs/core/Interaction.ts @@ -100,7 +100,7 @@ declare module '@interactjs/core/scope' { export type InteractionProxy = Pick< Interaction, - keyof typeof _ProxyValues | keyof typeof _ProxyMethods + Exclude > let idCounter = 0 diff --git a/packages/@interactjs/core/scope.ts b/packages/@interactjs/core/scope.ts index 9a348a2ae..284c188ec 100644 --- a/packages/@interactjs/core/scope.ts +++ b/packages/@interactjs/core/scope.ts @@ -44,7 +44,6 @@ interface DocSignalArg { options: Record } -/** @internal */ export interface Plugin { [key: string]: any id?: string @@ -257,6 +256,11 @@ export class Scope { } } +// Keep Scope class internal, but expose minimal interface to avoid broken types when Scope is stripped out +export interface Scope { + fire(name: T, arg: SignalArgs[T]): void | false +} + /** @internal */ export function initScope(scope: Scope, window: Window | typeof globalThis) { scope.isInitialized = true diff --git a/scripts/bin/clean.js b/scripts/bin/clean.js index 5462da527..a1ee74fa4 100644 --- a/scripts/bin/clean.js +++ b/scripts/bin/clean.js @@ -1,7 +1,6 @@ const fs = require('fs') const path = require('path') -const del = require('del') const shell = require('shelljs') const { getBuiltJsFiles } = require('../utils') @@ -9,7 +8,7 @@ const { getBuiltJsFiles } = require('../utils') console.log('removing typescript generated files.') shell.exec('tsc -b types.tsconfig.json --clean') -getBuiltJsFiles().then(async (filenames) => { +Promise.all([getBuiltJsFiles(), import('del').then((m) => m.deleteAsync)]).then(async ([filenames, del]) => { console.log(`removing ${filenames.length} generated files and directories.`) await Promise.all( diff --git a/test/fixtures/dependentTsProject/tsconfig.json b/test/fixtures/dependentTsProject/tsconfig.json index 7643a8067..df1bd31b5 100644 --- a/test/fixtures/dependentTsProject/tsconfig.json +++ b/test/fixtures/dependentTsProject/tsconfig.json @@ -4,7 +4,7 @@ "module": "commonjs", "lib": ["dom", "esnext"], "strict": true, - "skipLibCheck": true, + "skipLibCheck": false, "esModuleInterop": true, "noEmit": true } diff --git a/types.tsconfig.json b/types.tsconfig.json index eef78adf2..5f6ff85fb 100644 --- a/types.tsconfig.json +++ b/types.tsconfig.json @@ -1,6 +1,6 @@ { "include": ["packages/@interactjs", "shims.d.ts"], - "exclude": ["**/*.spec.ts"], + "exclude": ["**/*.spec.ts", "packages/@interactjs/vue", "packages/@interactjs/react"], "compilerOptions": { "target": "esnext", "module": "esnext", diff --git a/yarn.lock b/yarn.lock index e82d62e5c..78d6e6674 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1911,11 +1911,6 @@ resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== -"@types/symbol-tree@^3.2.3": - version "3.2.5" - resolved "https://registry.npmjs.org/@types/symbol-tree/-/symbol-tree-3.2.5.tgz#70a848c75bccdbcededd259493cee33bcb57b097" - integrity sha512-zXnnyENt1TYQcS21MkPaJCVjfcPq7p7yc5mo5JACuumXp6sly5jnlS0IokHd+xmmuCbx6V7JqkMBpswR+nZAcw== - "@types/testing-library__jest-dom@^5.9.1": version "5.14.9" resolved "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.9.tgz#0fb1e6a0278d87b6737db55af5967570b67cb466"