mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
04ae0327c2
This adds both the recommended TypeScript checks, plus the recommended TypeScript checks that require type checking. This latter addition means that eslint essentially has to compile all of the TypeScript in the project, causing it to be slower. This isn't much of a problem in VS Code because there's a lot of caching being done, but it's clearly slower when run on the commandline. All of the errors are either fixed or suppressed. Some errors are suppressed because fixing them would be too laborious for the little value gained. The eslint config is also slightly refactored to separate the strictly TypeScript checks from the JavaScript checks.
11 lines
421 B
TypeScript
11 lines
421 B
TypeScript
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
export const createImageFromImageData = (data: ImageData) => {
|
|
const canvas = document.createElement('canvas');
|
|
canvas.width = data.width;
|
|
canvas.height = data.height;
|
|
const ctx = canvas.getContext('2d')!;
|
|
ctx.putImageData(data, 0, 0);
|
|
const url = canvas.toDataURL('image/png');
|
|
return Buffer.from(url.split(',')[1], 'base64');
|
|
};
|