Skip to content

Commit

Permalink
chore(types): suppress errors with @ts-expect-error directive instead…
Browse files Browse the repository at this point in the history
… of @ts-ignore (#3259)
  • Loading branch information
satelllte committed May 8, 2024
1 parent 96e0732 commit 9705b47
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions example/src/demos/Lines.tsx
Expand Up @@ -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)
}

Expand All @@ -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()
}
Expand Down
4 changes: 2 additions & 2 deletions packages/fiber/src/core/renderer.ts
Expand Up @@ -198,7 +198,7 @@ function createRenderer<TCanvas>(_roots: Map<TCanvas, Root>, _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)
Expand Down Expand Up @@ -426,7 +426,7 @@ function createRenderer<TCanvas>(_roots: Map<TCanvas, Root>, _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: () => {},
Expand Down
2 changes: 1 addition & 1 deletion packages/fiber/src/core/utils.ts
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/fiber/src/native/polyfills.ts
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions packages/fiber/tests/core/renderer.test.tsx
Expand Up @@ -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 () =>
Expand Down Expand Up @@ -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
})

Expand Down
4 changes: 2 additions & 2 deletions packages/test-renderer/src/createTestCanvas.ts
Expand Up @@ -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
Expand Down

0 comments on commit 9705b47

Please sign in to comment.