Skip to content

Commit

Permalink
chore: Port annotations for suppressing TS 4.8 type errors. (tensorfl…
Browse files Browse the repository at this point in the history
…ow#6075)

Googlers, see b/260116849 and cl/490119036. 

Google is internally upgrading to TS 4.8. We haven't yet upgraded so the
internal language team has asked us to annotate some code to suppress
some TS 4.8 type errors.
  • Loading branch information
bmd3k authored Nov 28, 2022
1 parent f0630c2 commit 885cd99
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import {
import {TfDomRepeat} from './tf-dom-repeat';

@customElement('tf-category-paginated-view')
// @ts-ignore(go/ts48upgrade) Fix code and remove this comment. Error:
// TS2344: Type 'CategoryItem' does not satisfy the constraint '{}'.
class TfCategoryPaginatedView<CategoryItem> extends TfDomRepeat<CategoryItem> {
static readonly template = html`
<template is="dom-if" if="[[_paneRendered]]" id="ifRendered">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,8 @@ class TfGraphControls extends LegacyElementMixin(
_deviceCheckboxClicked(event: Event) {
// Update the device map.
const input = event.target as HTMLInputElement;
// @ts-ignore(go/ts48upgrade) Fix code and remove this comment. Error:
// TS2322: Type 'object' is not assignable to type 'DeviceForStats'.
const devicesForStats: DeviceForStats = Object.assign(
{},
this.devicesForStats
Expand Down
2 changes: 2 additions & 0 deletions tensorboard/webapp/testing/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
* assumed not to have reference loops.
*/
export function deepFreeze<T>(obj: T): T {
// @ts-ignore(go/ts48upgrade) Fix code and remove this comment. Error:
// TS2769: No overload matches this call.
for (const val of Object.values(obj)) {
if (val && typeof val === 'object') {
deepFreeze(val);
Expand Down

0 comments on commit 885cd99

Please sign in to comment.