diff --git a/package.json b/package.json index 1ca391375d..c1b0d11ccc 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "@types/lodash": "^4.14.172", "@types/marked": "^2.0.4", "@types/node": "^16.4.13", + "@types/offscreencanvas": "^2019.6.3", "@types/requirejs": "^2.1.33", "@types/resize-observer-browser": "^0.1.6", "@types/three": "^0.131.0", @@ -60,7 +61,7 @@ "rollup": "^2.56.2", "terser": "^5.7.1", "tslib": "^2.3.0", - "typescript": "4.3.5" + "typescript": "4.4.2" }, "dependencies": { "@angular/animations": "^12.2.0", diff --git a/tensorboard/components/experimental/plugin_util/message.ts b/tensorboard/components/experimental/plugin_util/message.ts index e7bf9f551b..f77aa1eb11 100644 --- a/tensorboard/components/experimental/plugin_util/message.ts +++ b/tensorboard/components/experimental/plugin_util/message.ts @@ -87,14 +87,14 @@ export class IPC { } let replyPayload = null; - let replyError = null; + let replyError: string | null = null; if (this.listeners.has(type)) { const callback = this.listeners.get(type) as MessageCallback; try { const result = await callback(payload); replyPayload = result; } catch (e) { - replyError = e; + replyError = e as string; } } diff --git a/tensorboard/plugins/graph/tf_graph_common/minimap.ts b/tensorboard/plugins/graph/tf_graph_common/minimap.ts index a8ec6f0eb6..dfeeb026d9 100644 --- a/tensorboard/plugins/graph/tf_graph_common/minimap.ts +++ b/tensorboard/plugins/graph/tf_graph_common/minimap.ts @@ -81,7 +81,7 @@ export class Minimap { this.zoomG = zoomG; this.mainZoom = mainZoom; this.maxWandH = maxWandH; - let $shadowRoot = d3.select(minimap.shadowRoot); + let $shadowRoot = d3.select((minimap.shadowRoot as unknown) as Element); // The minimap will have 2 main components: the canvas showing the content // and an svg showing a rectangle of the currently zoomed/panned viewpoint. let $minimapSvg = $shadowRoot.select('svg'); diff --git a/tensorboard/webapp/runs/store/runs_reducers.ts b/tensorboard/webapp/runs/store/runs_reducers.ts index 63b1401964..e39fe785e3 100644 --- a/tensorboard/webapp/runs/store/runs_reducers.ts +++ b/tensorboard/webapp/runs/store/runs_reducers.ts @@ -118,11 +118,17 @@ const dataReducer: ActionReducer = createReducer( on(runsActions.fetchRunsRequested, (state, action) => { const nextRunsLoadState = {...state.runsLoadState}; for (const eid of action.requestedExperimentIds) { - nextRunsLoadState[eid] = { - lastLoadedTimeInMs: null, - ...nextRunsLoadState[eid], - state: DataLoadState.LOADING, - }; + if (!nextRunsLoadState[eid]) { + nextRunsLoadState[eid] = { + lastLoadedTimeInMs: null, + state: DataLoadState.LOADING, + }; + } else { + nextRunsLoadState[eid] = { + ...nextRunsLoadState[eid], + state: DataLoadState.LOADING, + }; + } } return {...state, runsLoadState: nextRunsLoadState}; @@ -178,11 +184,17 @@ const dataReducer: ActionReducer = createReducer( on(runsActions.fetchRunsFailed, (state, action) => { const nextRunsLoadState = {...state.runsLoadState}; for (const eid of action.requestedExperimentIds) { - nextRunsLoadState[eid] = { - lastLoadedTimeInMs: null, - ...nextRunsLoadState[eid], - state: DataLoadState.FAILED, - }; + if (!nextRunsLoadState[eid]) { + nextRunsLoadState[eid] = { + lastLoadedTimeInMs: null, + state: DataLoadState.FAILED, + }; + } else { + nextRunsLoadState[eid] = { + ...nextRunsLoadState[eid], + state: DataLoadState.FAILED, + }; + } } return {...state, runsLoadState: nextRunsLoadState}; }), diff --git a/tensorboard/webapp/widgets/line_chart_v2/lib/BUILD b/tensorboard/webapp/widgets/line_chart_v2/lib/BUILD index 14d9768ee5..79383e8c73 100644 --- a/tensorboard/webapp/widgets/line_chart_v2/lib/BUILD +++ b/tensorboard/webapp/widgets/line_chart_v2/lib/BUILD @@ -55,6 +55,7 @@ tf_ts_library( deps = [ ":internal_types", "//tensorboard/webapp/widgets/line_chart_v2/lib/renderer:types", + "@npm//@types/offscreencanvas", ], ) diff --git a/tensorboard/webapp/widgets/line_chart_v2/lib/renderer/BUILD b/tensorboard/webapp/widgets/line_chart_v2/lib/renderer/BUILD index b46b6060fa..8965709efe 100644 --- a/tensorboard/webapp/widgets/line_chart_v2/lib/renderer/BUILD +++ b/tensorboard/webapp/widgets/line_chart_v2/lib/renderer/BUILD @@ -17,6 +17,7 @@ tf_ts_library( "//tensorboard/webapp/widgets/line_chart_v2/lib:coordinator", "//tensorboard/webapp/widgets/line_chart_v2/lib:internal_types", "//tensorboard/webapp/widgets/line_chart_v2/lib:utils", + "@npm//@types/offscreencanvas", "@npm//@types/three", "@npm//three", ], diff --git a/tensorboard/webapp/widgets/line_chart_v2/lib/renderer/threejs_renderer.ts b/tensorboard/webapp/widgets/line_chart_v2/lib/renderer/threejs_renderer.ts index 0e5495acca..d9a4e6ffeb 100644 --- a/tensorboard/webapp/widgets/line_chart_v2/lib/renderer/threejs_renderer.ts +++ b/tensorboard/webapp/widgets/line_chart_v2/lib/renderer/threejs_renderer.ts @@ -12,6 +12,7 @@ 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. ==============================================================================*/ + import * as THREE from 'three'; import {hsl, interpolateHsl} from '../../../../third_party/d3'; @@ -287,7 +288,7 @@ export class ThreeRenderer implements ObjectRenderer { antialias: true, precision: 'highp', alpha: true, - }) as WebGLRenderingContext, + } as WebGLContextAttributes) as WebGLRenderingContext, }); this.renderer.setPixelRatio(devicePixelRatio); } diff --git a/tensorboard/webapp/widgets/line_chart_v2/lib/worker/BUILD b/tensorboard/webapp/widgets/line_chart_v2/lib/worker/BUILD index f614a5f0af..a049373212 100644 --- a/tensorboard/webapp/widgets/line_chart_v2/lib/worker/BUILD +++ b/tensorboard/webapp/widgets/line_chart_v2/lib/worker/BUILD @@ -14,6 +14,7 @@ tf_ts_library( ":compact_data_series", "//tensorboard/webapp/widgets/line_chart_v2/lib:internal_types", "//tensorboard/webapp/widgets/line_chart_v2/lib/renderer:types", + "@npm//@types/offscreencanvas", ], ) diff --git a/tensorboard/webapp/widgets/line_chart_v2/lib/worker/worker_chart.ts b/tensorboard/webapp/widgets/line_chart_v2/lib/worker/worker_chart.ts index 48316b8fdb..1a06f5bb5c 100644 --- a/tensorboard/webapp/widgets/line_chart_v2/lib/worker/worker_chart.ts +++ b/tensorboard/webapp/widgets/line_chart_v2/lib/worker/worker_chart.ts @@ -71,7 +71,10 @@ export class WorkerChart implements Chart { useDarkMode: options.useDarkMode, }; - this.workerInstance.postMessage(initMessage, [canvas, channel.port2]); + this.workerInstance.postMessage(initMessage, [ + canvas, + channel.port2, + ] as Transferable[]); } dispose() { diff --git a/yarn.lock b/yarn.lock index bd3c422896..4e704a1d75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -412,9 +412,9 @@ integrity sha512-uvs0ir7me/KSIm4YGhkPolIjs+Fzjg6JrkRg8CYjnVLz+I6Ajr2+X9e3ylZP+0lNWhqJkkCjXm1jybPTUV5RKQ== "@bazel/typescript@^3.7.0": - version "3.7.0" - resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.7.0.tgz#a4d648a36f7ef4960c8a16222f853a4c285a522d" - integrity sha512-bkNHZaCWg4Jk+10wzhFDhB+RRZkfob/yydC4qRzUVxCDLPFICYgC0PWeLhf/ixEhVeHtS0Cmv74M+QziqKSdbw== + version "3.8.0" + resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.8.0.tgz#725d51a1c25e314a1d8cddb8b880ac05ba97acd4" + integrity sha512-4C1pLe4V7aidWqcPsWNqXFS7uHAB1nH5SUKG5uWoVv4JT9XhkNSvzzQIycMwXs2tZeCylX4KYNeNvfKrmkyFlw== dependencies: protobufjs "6.8.8" semver "5.6.0" @@ -1618,6 +1618,13 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.6.0.tgz#0d5685f85066f94e97f19e8a67fe003c5fadacc4" integrity sha512-OyiZPohMMjZEYqcVo/UJ04GyAxXOJEZO/FpzyXxcH4r/ArrVoXHf4MbUrkLp0Tz7/p1mMKpo5zJ6ZHl8XBNthQ== +"@types/offscreencanvas@^2019.6.3": + version "2019.6.3" + resolved "https://registry.yarnpkg.com/@types/offscreencanvas/-/offscreencanvas-2019.6.3.tgz#0508eec9641f3228bf8a27009670166887dc966c" + integrity sha512-957DsU187Y90EmlXneuqrqnwmwCkC9oPyQ/IEGwmDRpMfuhcGtjIz72Me7HvdK04ZC16A0VWmv0TSNLwC9ZvXw== + dependencies: + "@types/webgl2" "*" + "@types/offscreencanvas@~2019.3.0": version "2019.3.0" resolved "https://registry.yarnpkg.com/@types/offscreencanvas/-/offscreencanvas-2019.3.0.tgz#3336428ec7e9180cf4566dfea5da04eb586a6553" @@ -1655,6 +1662,11 @@ resolved "https://registry.yarnpkg.com/@types/webgl-ext/-/webgl-ext-0.0.30.tgz#0ce498c16a41a23d15289e0b844d945b25f0fb9d" integrity sha512-LKVgNmBxN0BbljJrVUwkxwRYqzsAEPcZOe6S2T6ZaBDIrFp0qu4FNlpc5sM1tGbXUYFgdVQIoeLk1Y1UoblyEg== +"@types/webgl2@*": + version "0.0.6" + resolved "https://registry.yarnpkg.com/@types/webgl2/-/webgl2-0.0.6.tgz#1ea2db791362bd8521548d664dbd3c5311cdf4b6" + integrity sha512-50GQhDVTq/herLMiqSQkdtRu+d5q/cWHn4VvKJtrj4DJAjo1MNkWYa2MA41BaBO1q1HgsUjuQvEOk0QHvlnAaQ== + "@types/webgl2@0.0.5": version "0.0.5" resolved "https://registry.yarnpkg.com/@types/webgl2/-/webgl2-0.0.5.tgz#dd925e20ab8ace80eb4b1e46fda5b109c508fb0d" @@ -5091,7 +5103,12 @@ type-is@~1.6.17: media-typer "0.3.0" mime-types "~2.1.24" -typescript@4.3.5, typescript@~4.3.5: +typescript@4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86" + integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ== + +typescript@~4.3.5: version "4.3.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==