I am attempting to use TS 2.8's TextDecoder interface to convert a Uint8Array to string for purposes of displaying an image in a web UI. The method I'm attempting to use is below:
displayImage(image: Uint8Array): string {
var fileString = new TextDecoder("utf-8").decode(image);
return 'data:image/jpeg;base64,' + fileString;
}
When I try to compile I receive "'TS2304: Cannot find name 'TextDecoder'".
I'm running TS 2.8 so according to this what I'm trying should work using the built-in interface. Is this a case of needing to define a provider? Any help appreciated.
EDIT: tsconfig.json below:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}