infinitered / nsfwjs

NSFW detection on the client-side via TensorFlow.js
https://nsfwjs.com/
MIT License
7.8k stars 515 forks source link

🐛 Typescript type errors #710

Open Skipperlla opened 1 year ago

Skipperlla commented 1 year ago
node_modules/@types/offscreencanvas/index.d.ts:10:22 - error TS2304: Cannot find name 'CanvasImageSource'.

10     drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number): void;
                        ~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:11:22 - error TS2304: Cannot find name 'CanvasImageSource'.

11     drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number, dw: number, dh: number): void;
                        ~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:12:22 - error TS2304: Cannot find name 'CanvasImageSource'.

12     drawImage(image: CanvasImageSource | OffscreenCanvas, sx: number, sy: number, sw: number, sh: number,
                        ~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:17:43 - error TS2304: Cannot find name 'ImageBitmapSource'.

17 declare function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas): Promise<ImageBitmap>;
                                             ~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:17:89 - error TS2304: Cannot find name 'ImageBitmap'.

17 declare function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas): Promise<ImageBitmap>;
                                                                                           ~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:18:43 - error TS2304: Cannot find name 'ImageBitmapSource'.

18 declare function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas, sx: number, sy: number,
                                             ~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:19:38 - error TS2304: Cannot find name 'ImageBitmap'.

19     sw: number, sh: number): Promise<ImageBitmap>;
                                        ~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:22:37 - error TS2304: Cannot find name 'HTMLElement'.

22 interface HTMLCanvasElement extends HTMLElement {
                                       ~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:27:53 - error TS2304: Cannot find name 'CanvasState'.

27 interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing,
                                                       ~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:27:66 - error TS2304: Cannot find name 'CanvasTransform'.

27 interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing,
                                                                    ~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:27:83 - error TS2304: Cannot find name 'CanvasCompositing'.

27 interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing,
                                                                                     ~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:28:9 - error TS2304: Cannot find name 'CanvasImageSmoothing'.

28         CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect,
           ~~~~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:28:31 - error TS2304: Cannot find name 'CanvasFillStrokeStyles'.

28         CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect,
                                 ~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:28:55 - error TS2304: Cannot find name 'CanvasShadowStyles'.

28         CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect,
                                                         ~~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:28:75 - error TS2304: Cannot find name 'CanvasFilters'.

28         CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect,
                                                                             ~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:28:90 - error TS2304: Cannot find name 'CanvasRect'.

28         CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect,
                                                                                            ~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:29:9 - error TS2304: Cannot find name 'CanvasDrawPath'.

29         CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles,
           ~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:29:25 - error TS2304: Cannot find name 'CanvasText'.

29         CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles,
                           ~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:29:54 - error TS2304: Cannot find name 'CanvasImageData'.

29         CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles,
                                                        ~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:29:71 - error TS2304: Cannot find name 'CanvasPathDrawingStyles'.

29         CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles,
                                                                         ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:30:9 - error TS2304: Cannot find name 'CanvasTextDrawingStyles'.

30         CanvasTextDrawingStyles, CanvasPath {
           ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:30:34 - error TS2304: Cannot find name 'CanvasPath'.

30         CanvasTextDrawingStyles, CanvasPath {
                                    ~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:42:53 - error TS2304: Cannot find name 'CanvasRenderingContext2DSettings'.

42     getContext(contextId: "2d", contextAttributes?: CanvasRenderingContext2DSettings):
                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:44:56 - error TS2304: Cannot find name 'WebGLContextAttributes'.

44     getContext(contextId: "webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null;
                                                          ~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:44:81 - error TS2304: Cannot find name 'WebGLRenderingContext'.

44     getContext(contextId: "webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null;
                                                                                   ~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:46:11 - error TS2304: Cannot find name 'WebGLRenderingContext'.

46         | WebGLRenderingContext | null;
             ~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/offscreencanvas/index.d.ts:47:30 - error TS2304: Cannot find name 'ImageBitmap'.

47     transferToImageBitmap(): ImageBitmap;
                                ~~~~~~~~~~~

node_modules/@types/webgl-ext/index.d.ts:11:76 - error TS2304: Cannot find name 'WebGLContextAttributes'.

11  getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): (WebGLRenderingContext & WebGL1Extensions) | null;
                                                                              ~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/webgl-ext/index.d.ts:11:102 - error TS2304: Cannot find name 'WebGLRenderingContext'.

11  getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): (WebGLRenderingContext & WebGL1Extensions) | null;
                                                                                                        ~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/webgl-ext/index.d.ts:22:63 - error TS2304: Cannot find name 'EXT_texture_filter_anisotropic'.

22  getExtension(name: "WEBKIT_EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic; // Chrome
                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/webgl-ext/index.d.ts:25:62 - error TS2304: Cannot find name 'WEBGL_compressed_texture_s3tc'.

25  getExtension(name: "WEBKIT_WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc; // Chrome
                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/webgl-ext/index.d.ts:26:52 - error TS2304: Cannot find name 'WEBGL_depth_texture'.

26  getExtension(name: "WEBKIT_WEBGL_depth_texture"): WEBGL_depth_texture; // Chrome
                                                      ~~~~~~~~~~~~~~~~~~~

node_modules/@types/webgl-ext/index.d.ts:27:51 - error TS2304: Cannot find name 'WEBGL_lose_context'.

27  getExtension(name: "WEBKIT_WEBGL_lose_context"): WEBGL_lose_context; // Chrome
                                                     ~~~~~~~~~~~~~~~~~~

@tensorflow/tfjs-node and nsfwjs when I load these two libraries, I get these errors and I can't declare it in any way, do you have a solution for this?

cdanwards commented 1 year ago

@Skipperlla is this occurring when you try to use a method? or within the files themselves?

Skipperlla commented 1 year ago

@cdanwards As soon as I upload the libraries and import them to my page, these errors appear.