From 61480103dee0aab6838401287d8430a74839bff0 Mon Sep 17 00:00:00 2001 From: Yehor <20585619+satelllte@users.noreply.github.com> Date: Wed, 8 May 2024 21:51:47 +0300 Subject: [PATCH] replace to @ts-expect-error, but leave user-facing @ts-ignore pragmas --- example/src/demos/Lines.tsx | 4 ++-- packages/fiber/src/core/renderer.ts | 4 ++-- packages/fiber/src/core/utils.ts | 2 +- packages/fiber/src/native/polyfills.ts | 2 +- packages/fiber/tests/core/renderer.test.tsx | 8 ++++---- packages/test-renderer/src/createTestCanvas.ts | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/example/src/demos/Lines.tsx b/example/src/demos/Lines.tsx index 0fe101a880..2ea176b747 100644 --- a/example/src/demos/Lines.tsx +++ b/example/src/demos/Lines.tsx @@ -32,7 +32,7 @@ function useDrag(onDrag: any, onEnd: any) { setActive(true) toggle(false) event.stopPropagation() - // @ts-ignore + // @ts-expect-error event.target.setPointerCapture(event.pointerId) } @@ -41,7 +41,7 @@ function useDrag(onDrag: any, onEnd: any) { setActive(false) toggle(true) event.stopPropagation() - // @ts-ignore + // @ts-expect-error event.target.releasePointerCapture(event.pointerId) if (onEnd) onEnd() } diff --git a/packages/fiber/src/core/renderer.ts b/packages/fiber/src/core/renderer.ts index 329036b04d..3149eae9d5 100644 --- a/packages/fiber/src/core/renderer.ts +++ b/packages/fiber/src/core/renderer.ts @@ -198,7 +198,7 @@ function createRenderer(_roots: Map, _getEventPriority?: detach(parentInstance, child, child.__r3f.attach) } else if (child.isObject3D && parentInstance.isObject3D) { parentInstance.remove(child) - // @ts-ignore + // @ts-expect-error // Remove interactivity on the initial root if (child.__r3f?.root) { removeInteractivity(findInitialRoot(child), child as unknown as THREE.Object3D) @@ -426,7 +426,7 @@ function createRenderer(_roots: Map, _getEventPriority?: hideTextInstance: handleTextInstance, unhideTextInstance: handleTextInstance, // https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874 - // @ts-ignore + // @ts-expect-error getCurrentEventPriority: () => (_getEventPriority ? _getEventPriority() : DefaultEventPriority), beforeActiveInstanceBlur: () => {}, afterActiveInstanceBlur: () => {}, diff --git a/packages/fiber/src/core/utils.ts b/packages/fiber/src/core/utils.ts index 35cc27617d..45cdf58f71 100644 --- a/packages/fiber/src/core/utils.ts +++ b/packages/fiber/src/core/utils.ts @@ -352,7 +352,7 @@ export function applyProps(instance: Instance, data: InstanceProps | DiffSet) { // create a blank slate of the instance and copy the particular parameter. let ctor = DEFAULTS.get(currentInstance.constructor) if (!ctor) { - // @ts-ignore + // @ts-expect-error ctor = new currentInstance.constructor() DEFAULTS.set(currentInstance.constructor, ctor) } diff --git a/packages/fiber/src/native/polyfills.ts b/packages/fiber/src/native/polyfills.ts index d3bade8317..b61b2d9fcb 100644 --- a/packages/fiber/src/native/polyfills.ts +++ b/packages/fiber/src/native/polyfills.ts @@ -141,7 +141,7 @@ export function polyfills() { texture.needsUpdate = true // Force non-DOM upload for EXGL texImage2D - // @ts-ignore + // @ts-expect-error texture.isDataTexture = true onLoad?.(texture) diff --git a/packages/fiber/tests/core/renderer.test.tsx b/packages/fiber/tests/core/renderer.test.tsx index 0ac0a83ed3..443ac9d531 100644 --- a/packages/fiber/tests/core/renderer.test.tsx +++ b/packages/fiber/tests/core/renderer.test.tsx @@ -746,9 +746,9 @@ describe('renderer', () => { expect(gl.toneMapping).toBe(THREE.ACESFilmicToneMapping) expect(texture.encoding).toBe(sRGBEncoding) - // @ts-ignore + // @ts-expect-error THREE.WebGLRenderer.prototype.outputColorSpace ??= '' - // @ts-ignore + // @ts-expect-error THREE.Texture.prototype.colorSpace ??= '' await act(async () => @@ -780,9 +780,9 @@ describe('renderer', () => { expect(gl.outputColorSpace).toBe(SRGBColorSpace) expect(texture.colorSpace).toBe(SRGBColorSpace) - // @ts-ignore + // @ts-expect-error delete THREE.WebGLRenderer.prototype.outputColorSpace - // @ts-ignore + // @ts-expect-error delete THREE.Texture.prototype.colorSpace }) diff --git a/packages/test-renderer/src/createTestCanvas.ts b/packages/test-renderer/src/createTestCanvas.ts index 1c8db1c89d..d70032af84 100644 --- a/packages/test-renderer/src/createTestCanvas.ts +++ b/packages/test-renderer/src/createTestCanvas.ts @@ -30,9 +30,9 @@ export const createCanvas = ({ beforeReturn, width = 1280, height = 800 }: Creat beforeReturn?.(canvas) class WebGLRenderingContext extends WebGL2RenderingContext {} - // @ts-ignore + // @ts-expect-error globalThis.WebGLRenderingContext ??= WebGLRenderingContext - // @ts-ignore + // @ts-expect-error globalThis.WebGL2RenderingContext ??= WebGL2RenderingContext return canvas