Skip to content

Commit 62f4b59

Browse files
author
Nikhil Thorat
authored
Get tfjs-core ready for TS 3.5 (#1833)
DEV
1 parent a015b38 commit 62f4b59

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tfjs-core/src/tensor.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ export class Tensor<R extends Rank = Rank> {
619619
if (this.dtype === 'string') {
620620
const bytes = await data as Uint8Array[];
621621
try {
622-
return bytes.map(b => util.decodeString(b));
622+
return bytes.map(b => util.decodeString(b)) as DataTypeMap[D];
623623
} catch {
624624
throw new Error(
625625
'Failed to decode the string bytes into utf-8. ' +
@@ -639,7 +639,8 @@ export class Tensor<R extends Rank = Rank> {
639639
const data = trackerFn().readSync(this.dataId);
640640
if (this.dtype === 'string') {
641641
try {
642-
return (data as Uint8Array[]).map(b => util.decodeString(b));
642+
return (data as Uint8Array[]).map(b => util.decodeString(b)) as
643+
DataTypeMap[D];
643644
} catch {
644645
throw new Error(
645646
'Failed to decode the string bytes into utf-8. ' +

0 commit comments

Comments
 (0)