fix typescript errors, add tsconfig.json

This commit is contained in:
Ninja3047 2022-07-27 21:54:10 -04:00
parent 253fccaf78
commit 7c383e8cd0
No known key found for this signature in database
2 changed files with 18 additions and 7 deletions

13
tsconfig.json Normal file
View file

@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"jsx": "react",
"module": "commonjs", /* Specify what module code is generated. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
// "strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

View file

@ -25,15 +25,13 @@ require('highlightjs-line-numbers.js');
const FileForm = () => { const FileForm = () => {
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
let file = event.target.files![0];
const fr = new FileReader(); const fr = new FileReader();
fr.onload = (e) => { fr.onload = (_e) => {
const { result } = e.target; let data = new Uint8Array(fr.result as ArrayBuffer);
if (result instanceof ArrayBuffer) { encrypt_array_buffer(data);
let data = new Uint8Array(result);
encrypt_array_buffer(data);
}
} }
fr.readAsArrayBuffer((event.target as HTMLInputElement).files[0]); fr.readAsArrayBuffer(file);
} }
return ( return (