Explorar o código

chore(deps): bump typescript from 4.1.5 to 4.2.3 (#3196)

* chore(deps): bump typescript from 4.1.5 to 4.2.3

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.1.5 to 4.2.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.1.5...v4.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

* hack types

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
dependabot[bot] %!s(int64=4) %!d(string=hai) anos
pai
achega
862c065e33
Modificáronse 3 ficheiros con 21 adicións e 17 borrados
  1. 1 1
      package.json
  2. 16 12
      src/components/App.tsx
  3. 4 4
      yarn.lock

+ 1 - 1
package.json

@@ -46,7 +46,7 @@
     "roughjs": "4.3.1",
     "sass": "1.32.8",
     "socket.io-client": "2.3.1",
-    "typescript": "4.1.5"
+    "typescript": "4.2.3"
   },
   "devDependencies": {
     "@excalidraw/eslint-config": "1.0.0",

+ 16 - 12
src/components/App.tsx

@@ -532,18 +532,22 @@ class App extends React.Component<ExcalidrawProps, AppState> {
         }
 
         this.setState(
-          (state) => ({
-            ...actionResult.appState,
-            editingElement:
-              editingElement || actionResult.appState?.editingElement || null,
-            width: state.width,
-            height: state.height,
-            offsetTop: state.offsetTop,
-            offsetLeft: state.offsetLeft,
-            viewModeEnabled,
-            zenModeEnabled,
-            gridSize,
-          }),
+          (state) => {
+            // using Object.assign instead of spread to fool TS 4.2.2+ into
+            // regarding the resulting type as not containing undefined
+            // (which the following expression will never contain)
+            return Object.assign(actionResult.appState || {}, {
+              editingElement:
+                editingElement || actionResult.appState?.editingElement || null,
+              width: state.width,
+              height: state.height,
+              offsetTop: state.offsetTop,
+              offsetLeft: state.offsetLeft,
+              viewModeEnabled,
+              zenModeEnabled,
+              gridSize,
+            });
+          },
           () => {
             if (actionResult.syncHistory) {
               history.setCurrentState(

+ 4 - 4
yarn.lock

@@ -13967,10 +13967,10 @@ typedarray@^0.0.6:
   resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
   integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
 
-typescript@4.1.5:
-  version "4.1.5"
-  resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72"
-  integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==
+typescript@4.2.3:
+  version "4.2.3"
+  resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
+  integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
 
 unicode-canonical-property-names-ecmascript@^1.0.4:
   version "1.0.4"